Conal Elliott <co...@conal.net> wrote: > > 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).
Well, it does capture concurrency and FFI, but it has no explicit notion for it. In other words, concurrent threads and FFI calls are effects like everything else, so the forkIO function just changes the world state implicitly and that's it. > I don't know whether/how the "EDSL model" you mention addresses > concurrency or FFI. Just like the state monad model. This is not a weakness of the interpretation, but of the IO monad itself, because it is quite a raw and straightforward language for doing I/O. Other approaches like functional reactive programming may be better at capturing these things, particularly the interactions between concurrent threads, at least for specific applications. > So, maybe these models are models of something other (and much less > expressive) than Haskell's IO. Which re-raises Jerzy's question. Haskell's IO is flexible at the cost of being quite low level. I think to capture things like concurrency properly and explicitly you need a richer sublanguage, maybe something based on the pi calculus. 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