[Haskell-cafe] Re: Move MonadIO to base
andersk at MIT.EDU
Tue Apr 20 23:01:36 EDT 2010
On Tue, 20 Apr 2010, wren ng thornton wrote:
> -- | The isomorphic Haskell98 version
> class Monad m => MonadJoinIO m where
> -- | Embed the IO into the monad m
> joinIO :: IO (m a) -> m a
> -- | Extract the IO computation to the top level,
> -- rendering the m pure from IO.
> partIO :: m a -> IO (m a)
> -- | The isomorphisms
> joinIO' m = morphIO (m >>=)
> morphIO' f = joinIO (f partIO)
To establish an isomorphism, you also need to define partIO from morphIO.
For example, I don’t see how I could define
partIO :: IO a -> IO (ReaderT r IO a)
that extracts effects into the outer IO, because the effects depend on
some unknown state of type r.
By the way:
> This bounced because I have different emails registered for cafe@ and
> libraries@, so forwarding it along to the cafe.
You can sign up both addresses for the list, then log in to the Mailman
web interface ( http://www.haskell.org/mailman/listinfo/haskell-cafe →
Unsubscribe or edit options) and disable mail delivery on one of them.
Then you get one copy of each message but you can post from either
More information about the Libraries