distributors-0.3.0.0: Unifying Parsers, Printers & Grammars
Copyright(C) 2026 - Eitan Chatav
LicenseBSD-style (see the file LICENSE)
MaintainerEitan Chatav <eitan.chatav@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Profunctor.Monadic

Contents

Description

See Li-yao Xia, Monadic profunctors for bidirectional programming

This module can provide qualified do-notation for Monadic profunctors.

>>> :set -XQualifiedDo
>>> import qualified Data.Profunctor.Monadic as P

See Control.Lens.Grammar for an example of how to use "bonding" notation.

Synopsis

Monadic

type Monadic p = (Profunctor p, forall x. Monad (p x)) Source #

A Profunctor which is also a Monad.

(>>=) :: Monadic p => p a b -> (b -> p c d) -> p (a, c) (b, d) infixl 1 Source #

The pair bonding operator P.>>= is a context-sensitive version of >*<.

x >*< y = x P.>>= (\_ -> y)

(>>) :: Monadic p => p () c -> p a b -> p a b infixl 1 Source #

P.>> sequences actions.

return :: Monad m => a -> m a #

Inject a value into the monadic type.

fail :: MonadFail m => String -> m a #