[Haskell-beginners] Re: clarification on IO
Will Ness
will_n48 at yahoo.com
Sun Mar 1 05:28:24 EST 2009
Michael Easter <codetojoy <at> gmail.com> writes:
>
>
> Thanks Andrew, this is really great...My main revelation here is that a "side-
effect" in other monads is still pure. e.g. The Logger example in RWH builds
up a list of log strings "behind the scenes" but this is much different than
writing to disk, or launching missiles, to quote SP Jones.
May be this is exactly how we ought to look at the IO monad - as a Logger
monad? Each IO-bound chain of action-functions defining an IO value that holds
a record of what it is the IO primitives that we used promised us they will do
when run by the system.
That's it.
(?)
After all, we can have a definition of such a value, and have it run multiple
times for us, so _as definition_ it's no different than any other definition in
Haskell. It's just that _its value_ can cause the system to actually perform
these IO actions in some circumstances.
As for terminology: we've got to have some special name for functions that are
chainable by bind. Calling them actions confuses them with the real world
actions performed by IO.
May be to call them "action functions"?
More information about the Beginners
mailing list