[Haskell-cafe] Monad transformers

Mike Dillon mike at embody.org
Sat Jul 3 19:35:41 EDT 2010

begin Andrew Coppin quotation:
> Roman Cheplyaka wrote:
> >See above:
> >-- Dynamic components may be retrieved with 'get', static components
> >-- with 'ask'.
> >
> >So you use ask to get some configuration variable (reader monad is used
> >for configuration in xmonad) and get/put/modify to deal with dynamic
> >state of application. You use liftIO (abbreviated to 'io') to run IO
> >computations.
> In other words, somebody has written a combinatorial explosion of
> class instances to automate some of the lifting.

Well then you need to automate writing the instances too :)

The GeneralizedNewtypeDeriving extension can be used to get instances
for Monad, MonadReader XConf, MonadState XState, and MonadIO
automatically for a newtype like X that should suffice in most cases.


More information about the Haskell-Cafe mailing list