Safe Haskell | Safe-Infered |
---|

# Indexed Monads

I deviate from Conor's terminology, referring to his monads on indexed types as "indexed monads" and referring to his indexed monads as "restricted monads". This module provides "indexed monads".

Indexed monads generalize the traditional approach to parametrizing the
initial and final states of ordinary monads. The `IMonad`

class does not
require specifying a concrete index of kind `*`

for the intermediate or
final state of the `bindI`

operation, permitting operations which may end in
multiple possible states.

An endofunctor within the category of index-preserving functions

All instances must satisfy the functor laws:

fmapI id == id fmapI (f . g) == fmapI f . fmapI g

class IFunctor m => IMonad m whereSource

An indexed monad

All instances must satisfy the monad laws:

returnI >?> f = f f >?> returnI = f (f >?> g) >?> h = f >?> (g >?> h)