
Creighton Hogg schrieb:
Okay, so I think what you want is
[...]
Yes. Your solution works. Thank you. But:
a <- msum . map return $ [1,2,3]
Why Do I need this "msum . map return" thing? The "map return" part is somewhat clear. But not entirely. Which type of monad is created here? The msum-part ist totally confusing me: First we create a list with some monads (?) and then msum them? What is going on there?
first, that you tried to use literal list syntax in do notation which I believe only works in the actual [] monad.
Is the "x <- xs" in the list monad a form of syntactic sugar?
Second, you didn't have the runListT acting on the foobar, which is how you go from a ListT IO Int to a IO [Int].
Ah, yes. This point I understood now. Thank you again. Michael