[Haskell-beginners] in which monad am I?

Francesco Guerrieri f.guerrieri at gmail.com
Sun Jan 3 16:38:28 EST 2010


Hello, this is my first post to the list.

I am learning Haskell and I think I understand monads (well, that
doesn't mean that I actually understand them :-) )
Nevertheless, I would like to check something with you.
My question is: how do you know in which monad you are computing at a
given time?
What I mean is that, when dealing with more than a monad at the same
time (Maybe, List, IO come to my mind) if I understand correctly you
have to lift values back and forth from a monad to the other. How do
you "keep" track of the monad you are in a given time? I think that
the type system will help to resolve to the relevant function (eg,
thinking to liftM signature, liftM   :: (Monad m) => (a1 -> r) -> m a1
-> m r

But doesn't ever happen that poor liftM be confused? and do poor
haskell programmers never feel the need to explicitly state to which
monad they "wish to lift" ?

I hope it's not a too  silly question. If so, please point me to the
relevant resouces (Are  monad transformers relevant to my issue?)

Thanks in advance,
Francesco


More information about the Beginners mailing list