extensible-effects- An Alternative to Monad Transformers

Safe HaskellSafe



Lifting primitive Monad types to effectful computations. We only allow a single Lifted Monad because Monads aren't commutative (e.g. Maybe (IO a) is functionally distinct from IO (Maybe a)).



newtype Lift m a Source #

Lifting: emulating monad transformers


Lift (m a) 

lift :: SetMember Lift (Lift m) r => m a -> Eff r a Source #

We make the Lift layer to be unique, using SetMember

runLift :: Monad m => Eff '[Lift m] w -> m w Source #

The handler of Lift requests. It is meant to be terminal: we only allow a single Lifted Monad.

catchDynE :: forall e a r. (SetMember Lift (Lift IO) r, Exception e) => Eff r a -> (e -> Eff r a) -> Eff r a Source #

Catching of dynamic exceptions See the problem in http://okmij.org/ftp/Haskell/misc.html#catch-MonadIO