transformers: instance MonadTrans Compose

Henning Thielemann lemming at henning-thielemann.de
Sun Dec 16 19:30:45 CET 2012


What about this instance:

module Data.Functor.Compose

import Control.Monad.Trans.Class (MonadTrans, lift)


instance (Monad f) => MonadTrans (Compose f) where
     lift x = Compose (return x)

?

The constraint (Monad f) is ugly. An (Applicative f) may not fit to a 
*Monad*Trans class. On the other hand, Compose is more oftenly used to 
compose Applicative functors.



More information about the Libraries mailing list