Safe Haskell | None |
---|---|

Language | Haskell2010 |

- newtype Eff f m a = Eff (forall g r. (forall x. Sum f m x -> Cont (g r) x) -> Cont (g r) a)
- translate :: (Monad m, Monad (t m), MonadTrans t) => (forall x r. f x -> ContT r (t m) x) -> Eff f m a -> t m a
- class (IsEff m, Monad m) => Interprets p m | m -> p where
- interpret :: Interprets p m => p a -> m a
- type family IsEff (m :: * -> *) :: Constraint where ...

# Core API

The `Eff`

monad transformer is used to write programs that require access to
specific effects. In this library, effects are combined by stacking multiple
`Eff`

s together, just as you would do with traditional monad transformers.
`Eff`

s are parameterized by an effect *algebra*. This is a
description of programs in a single effect, such as non-determinism (`[]`

)or
exceptions (`Either e`

). As `Eff`

is a monad transformer, `m`

is the monad
that `Eff`

transforms, which can itself be another instance of `Eff`

.

(Monad m, Interprets f (Eff h m)) => Interprets f (Eff g (Eff h m)) Source # | |

Monad m => Interprets f (Eff f m) Source # | |

EffEnvironment env m => EffEnvironment env (Eff effects m) Source # | |

Monad m => EffEnvironment env (Eff (Reader env) m) Source # | |

EffException e m => EffException e (Eff f m) Source # | |

Monad m => EffException e (Eff (Either e) m) Source # | |

MonadTrans (Eff f) Source # | |

Monad (Eff f m) Source # | |

Functor (Eff f m) Source # | |

Applicative (Eff f m) Source # | |

MonadIO m => MonadIO (Eff effect m) Source # | |

EffUIO m => EffUIO (Eff r m) Source # | |

Monad m => Nondeterministic (Eff [] m) Source # | |

Nondeterministic m => Nondeterministic (Eff f m) Source # | |

translate :: (Monad m, Monad (t m), MonadTrans t) => (forall x r. f x -> ContT r (t m) x) -> Eff f m a -> t m a Source #

class (IsEff m, Monad m) => Interprets p m | m -> p where Source #

`LiftProgram`

defines an `mtl`

-style type class for automatically lifting
effects into `Eff`

stacks. When exporting libraries that you intend to
publish on Hackage, it's suggested that you still provide your own type class
(such as `MonadThrow`

or `MonadHTTP`

) to avoid locking people into this
library, but `interpret`

can be useful to define your own instances of
that type class for `Eff`

.

(Monad m, Interprets f (Eff h m)) => Interprets f (Eff g (Eff h m)) Source # | |

Monad m => Interprets f (Eff f m) Source # | |

interpret :: Interprets p m => p a -> m a Source #

type family IsEff (m :: * -> *) :: Constraint where ... Source #