index-core-1.0.4: Indexed Types

Safe HaskellSafe
LanguageHaskell2010

Control.IMonad.Trans

Contents

Description

This module is the indexed equivalent to Control.Monad.Trans.Class from the transformers package.

Synopsis

Monad Transformers

Indexed monad transformers transform computations in a base indexed monad into a higher indexed monad layered on top of the base monad.

Note that this does not lift ordinary monads. To do that you must first convert the ordinary monad to a restricted monad using the u function from Control.IMonad.Restrict and then use liftI like so:

-- Using indexed do notation provided by Control.IMonad.Do
do x <- indexedActionInHigherMonad
   liftI $ u $ ordinaryActionInBaseMonad x

class IMonadTrans t where Source #

An indexed monad transformer.

All instances must satisfy the monad transformer laws:

liftI . returnI = returnI

liftI . (f >?> g) = (liftI . f) >?> (liftI . g)

Minimal complete definition

liftI

Methods

liftI :: IMonad m => m a :-> t m a Source #

liftU :: (Monad m, IMonadTrans t) => m a -> t (U m) (a := i) i Source #

Lifts ordinary monads for restricted monad transformers

liftU = liftI . u