[Haskell-cafe] specialised monad transformers

Alberto G. Corona agocorona at gmail.com
Mon Aug 31 06:49:27 EDT 2009

Hi all

I want to define a partial monad transformer i.e not defined for all
kinds of data but the ones that have instances of certain classes.
That is because in my lift instance code there are some hidden use of
these classes.

But because in the MonadTrans definition does not refers to the data,
no specialised lift seems possible:

class MonadTrans t where
    lift :: Monad m => m a -> t m a

Is that true?

A possible adition could be to define (note: I did not test it, it is
just an idea):

class SpecialisedMonadTrans (t m a) where
   lift :: Monad m => m a -> t m a
   liftMN :: Monad m => m a -> t a

The whole problem has certain relation with effect control. This kind
of definition permits a more fine control of effect handling when
passing from a monad to other  depending on the idiosyncrasy of the
monad m and the kind of a.

More information about the Haskell-Cafe mailing list