monad library

Andrew J Bromage ajb@spamcop.net
Wed, 30 Jul 2003 12:14:43 +1000


G'day all.

On Sun, Jul 27, 2003 at 09:28:57PM +0200, Iavor Diatchki wrote:

> in my other library i had a similar operation, corresponding to 
> the fact that most monad transformers are functors on the category of 
> monads.  it works for all transformers except for continuations:
> 
> class MondaTrans t => MapTrans t where
>   mapTrans :: (Monad m, Monad n) => (forall a. m a -> n a) -> t m b -> 
> t n b
> 
> intuitively the "forall" constraint says that we are changing just the 
> monad, and not touching the value. to get continuations to work, one 
> needs a map (n a -> m a) as well, i think.   any comments about that class?

Looks pretty good to me, though I still don't like the name.

Cheers,
Andrew Bromage