[Haskell-cafe] Re[2]: strict Haskell dialect

Lennart Augustsson lennart at augustsson.net
Sat Feb 11 14:20:02 EST 2006

Bulat Ziganshin wrote:
> Hello Wolfgang,
> Saturday, February 11, 2006, 3:17:12 PM, you wrote:
>>> each and every monadic operation is a function!
> WJ> What do you mean with "monadic operatation"?  (>>=), (>>) and return are, of 
> WJ> course, functions but an I/O action like getChar is *not* a function.  Also a 
> WJ> list is not a function but a value of the list monad.
>>> type "IO a" is really "RealWorld -> (RealWorld,a)"
> WJ> This representation is just there to help people understand what I/O is but 
> WJ> actually, IO a is a type which is not implementable in ordinary Haskell and 
> WJ> therefore cannot be a function.  In addition, RealWorld -> (RealWorld,a) as 
> WJ> an explanation of what IO a is has its limitations.  If we run an I/O action, 
> WJ> we aren't just interested in the final state but also in intermediate states.
> {putStr "a"} is a function, which receives previous world state and
> returns updated world state where "a" is written to the terminal. it's
> an _essential_ part of monadic way to I/O

There is nothing in the Haskell specification that tells you how the
IO type is implemented, so you can't say that putStr takes an old
world state and returns a new one.  I've personally done an
implementation that was totally different, so making assumptions
about how IO is implemented is just wrong.

	-- Lennart

More information about the Haskell-Cafe mailing list