[Haskell-cafe] background question about IO monad

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Feb 6 04:30:08 EST 2008

Hello Uwe,

Wednesday, February 6, 2008, 7:44:27 AM, you wrote:

> But after that, it sure seems to me as if I've taken data out of the
> IO monad...

this means that you can't use results of IO actions in pure functions.
your code works in some transformed version of IO monad, so you don't
escaped it

if we call pure functions as "functions" and non-pure ones as
"procedures", the rule is "functions can't call procedures", but all
other activity is possible. in your do_action you calls procedure (to
format current time) and call a function (to format given time).
do_action is procedure (because it works in transformed IO monad), so
you don't break any rules

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list