Portability | portable |
---|---|

Stability | experimental |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Safe-Inferred |

This module provides the `Bound`

class, for performing substitution into
things that are not necessarily full monad transformers.

# Documentation

Instances of `Bound`

generate left modules over monads.

This means they should satisfy the following laws:

m >>>= return ≡ m m >>>= (λ x → k x >>= h) ≡ (m >>>= k) >>>=

This guarantees that a typical Monad instance for an expression type where Bound instances appear will satisfy the Monad laws (see doc/BoundLaws.hs).

If instances of Bound are monad transformers, then `m `

implies the above laws, and is in fact the default definition.
`>>>=`

f ≡ m `>>=`

`lift`

`.`

f

This is useful for types like expression lists, case alternatives, schemas, etc. that may not be expressions in their own right, but often contain expressions.