[Haskell-beginners] Monad problem

Marcin Mrotek marcin.jan.mrotek at gmail.com
Sat Jul 11 19:09:54 UTC 2015


Hello,

> Does this mean that they do not perform IO, or do IO but "break out
of" / hide their IO using unsafe or something?

No, monad transformers sort of compose "backwards", that is, if you
have something like FooT (BarT (IO a)) then after running everything,
you'll get something in the lines of IO (Bar (Foo a)). That's why IO,
if it is there at all, must be at the bottom of the stack.

Now, I don't know the library you're using, from the docs it would
appear that you indeed can runInstagramT without any IO in there, but
some of the actions defined force this or that constraint, and in
particular this "getUserAccessTokenURL2" forces (MonadControlBase IO
m), which is more or less a fancy way of saying that there must be IO
at the bottom.

Best regards,
Marcin Mrotek


More information about the Beginners mailing list