
Am Sonntag, 5. Februar 2006 17:36 schrieb Bulat Ziganshin:
[...]
each and every monadic operation is a function!
What do you mean with "monadic operatation"? (>>=), (>>) and return are, of course, functions but an I/O action like getChar is *not* a function. Also a list is not a function but a value of the list monad.
type "IO a" is really "RealWorld -> (RealWorld,a)"
This representation is just there to help people understand what I/O is but actually, IO a is a type which is not implementable in ordinary Haskell and therefore cannot be a function. In addition, RealWorld -> (RealWorld,a) as an explanation of what IO a is has its limitations. If we run an I/O action, we aren't just interested in the final state but also in intermediate states.
and the same for any other monad. concept of the monad by itself means carrying "hidden" state from one monadic operation to the next.
That's too specific. A list, for example, doesn't have to do anything with state and [a] is not represented as a function.
[...]
Best wishes, Wolfgang