
2 Aug
2007
2 Aug
'07
7:41 a.m.
On 8/2/07, Seth Gordon
Haskell solves the "how can I do I/O in a pure functional language" problem by *turning the world inside-out*. Instead of taking data from the mutable outside world, using functions to manipulate it, and depositing results back into that world, you put your functions into the IO monad.
That's a very interesting perspective. One of the questions often asked by Haskell newcomers is "how do I turn an IO a into an a?". The correct answer is that you don't; instead, you use a function (a -> m b) to indicate what you would have done with that a, and the bind operator takes care of the messy details for you. Stuart