[Haskell-beginners] Question regarding the ListT Monad Transformer

Edward Z. Yang ezyang at MIT.EDU
Wed Aug 4 13:42:02 EDT 2010

Excerpts from Tim Cowlishaw's message of Wed Aug 04 13:29:24 -0400 2010:
> However, while the second half of the transformation above is catered
> for via runListT - I can't seem to work out how to do the first -
> namely, to write a function of type [IO a] -> ListT IO a . To be
> honest, I'm not entirely sure I've entirely got my head around Monad
> Transformers yet - does what I'm describing make any sense at all, and
> if so, is there any chance you could point me in the right direction
> towards implementing (and hopefully understanding) this?

ListT IO a = IO [a], so you're looking for a function [IO a] -> IO [a].
This function is called sequence :: Monad m => [m a] -> m [a]

My best advice for you is to get rid of the newtype wrapping and unwrapping
when you're trying to an understand a monad transformer.


More information about the Beginners mailing list