
There are various models. One (the state monad model) of them would desugar this to:
\world0 -> let (x, world1) = getLine world0 world2 = print (x+1) world1 world3 = print (x+2) world2 in world3
Hi Ertugrul,
This state monad model does not really work for IO, since it fails to
capture IO's concurrency (with non-deterministic interleaving). I don't
know whether/how the "EDSL model" you mention addresses concurrency or FFI.
So, maybe these models are models of something other (and much less
expressive) than Haskell's IO. Which re-raises Jerzy's question.
Regards, - Conal
On Mon, Aug 9, 2010 at 10:38 PM, Ertugrul Soeylemez
jerzy.karczmarczuk@info.unicaen.fr wrote:
Alberto G. Corona writes:
(...) Desugarize the "do" notation, after that, desugarize the >>= and >> operators down to the function call notation and suddenly everithing lost its magic because it becomes clear that a haskell monad is a sugarization of plain functional tricks.
Yep.
But, BTW, could you tell me what was the result of the final desugarization and the BASIC sense of the IO monad for you?
Example:
do x <- getLine print (x+1) print (x+2)
There are various models. One (the state monad model) of them would desugar this to:
\world0 -> let (x, world1) = getLine world0 world2 = print (x+1) world1 world3 = print (x+2) world2 in world3
Another one (the EDSL model, which I personally prefer) would desugar it to something as simple as this:
GetLine `BindIO` \x -> Print (x+1) `BindIO` const (Print (x+2))
I wonder if there are more models for IO.
Greets, Ertugrul
-- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe