MonadMorphIO [Re: Move MonadIO to base]

wren ng thornton wren at
Fri Apr 23 20:21:33 EDT 2010

Anders Kaseorg wrote:
> • Can a class like this be expressed in Haskell ’98?  (But this seems to 
> be quite difficult, and I imagine we’ll be thinking about it for a while.)

I don't think[1] so. Fundamentally the problem is that you need to 
support both (things like) ReaderT and (things like) WriterT. That is, 
the portion of the type which is under IO (or could commutatively be 
made so) varies from monad to monad. Thus, it seems necessary to use 
extensions like rank-n (to abstract over the different structures) or 
MPTCs / associated types (to define relations on types).

The original liftIO gets around this problem because the input is a 
"pure" term (wrt the monad it's being lifted into) and therefore we 
don't have any structure to worry about traversing/manipulating.

[1] But I've been wrong before:

Live well,

More information about the Libraries mailing list