[Haskell-beginners] Question regarding the ListT Monad Transformer

Tim Cowlishaw tim at timcowlishaw.co.uk
Wed Aug 4 13:29:24 EDT 2010


Hey all,

I'm trying to get my head around the ListT Monad Transformer, and am
having trouble working out how to use it.

Essentially, I am trying to transform a type of [IO a] to IO [a] I'd
assumed that this might work something like this

Transform [IO a] to ListT IO a

call runListT to transform ListT IO a to IO [a]

..having I'd assumed that this was the correct situation to use a
Monad Transformer, as I'm layering monads around each other.

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?

Cheers,

Tim


More information about the Beginners mailing list