Ross Paterson wrote:
But IO isn't a state monad: others are concurrently changing the world
without waiting for my Haskell program to terminate.

I think that closed-world behavior should be treated as a property of runST, not of the ST monad operations. Otherwise your IORef = STRef IORegion proposal doesn't work either, because e.g.

    myId :: STRef s a -> a -> ST s a
    myId r x = writeSTRef r x >> readSTRef r

doesn't necessarily return its second argument when lifted to IO, in the presence of multithreading.

This philosophical objection to IO = ST IORegion has come up before, and I think it's approaching the problem exactly backwards. If IO = ST IORegion works in practice and is useful in practice, then we ought to be coming up with a theory of IO/ST that supports it, not rejecting it on the basis of a theory that doesn't support it.

-- Ben
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to