bound-1.0.3: Making de Bruijn Succ Less

MaintainerEdward Kmett <>
Safe HaskellSafe-Inferred



This module provides the Bound class, for performing substitution into things that are not necessarily full monad transformers.



class Bound t whereSource

Instances of Bound generate left modules over monads.

This means they should satisfy the following laws:

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

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 >>>= f ≡ m >>= lift . f implies the above laws, and is in fact the default definition.

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.


(>>>=) :: Monad f => t f a -> (a -> f c) -> t f cSource

Perform substitution

If t is an instance of MonadTrans and you are compiling on GHC >= 7.4, then this gets the default definition:

m >>>= f = m >>= lift . f


(=<<<) :: (Bound t, Monad f) => (a -> f c) -> t f a -> t f cSource

A flipped version of (>>>=).

(=<<<) = flip (>>>=)