
Tillmann Rendel
Bulat Ziganshin wrote:
But in a world passing interpretation of IO, print is supposed to be a pure Haskell function. So the value world2 can only depend on the values of print and world1, but not on the actions of some concurrent thread.
the whole World includes any concurrent thread though ;)
Oh I see. So given world1, print can simulate the behavior of the concurrent thread to take it into account when constructing world2. Since that simulation depends only on world1, print is still pure.
Does that mean that world passing *does* account for concurrency after all?
Exactly. If at any point you use forkIO, then the world is updated to include the new thread. That's why I find it wrong to say that this mental model doesn't capture concurrency. It just has no explicit notion for it, but neither has IO. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/