restructuring the mtl

Ross Paterson ross at soi.city.ac.uk
Wed Mar 7 19:35:47 EST 2007


On Wed, Mar 07, 2007 at 04:11:59PM -0800, Stefan O'Rear wrote:
> Why can't we have:
> 
> class MonadTrans t where
>   lift :: Monad m => m a -> t m a

Yes, we could.

>   metalift :: (Monad m, Monad m') => (forall a. m a -> m' a) -> t m a -> t m' b

This is a functor on the category of monads -- definitely useful.

> Disclaimer: I have been able to write instances for all mtl
> transformers *except ContT*, and it seems plausible that ContT may
> force the class to be split. 

You and Moggi both (Remark 4.1.11 of "An Abstract View of Programming
Languages").



More information about the Libraries mailing list