[Haskell-cafe] Why no IO transformer monad?
Ross Paterson
ross at soi.city.ac.uk
Mon Dec 20 10:06:54 EST 2004
On Mon, Dec 20, 2004 at 02:16:52PM +0000, Keean Schupke wrote:
> Surely if IO is (ST RealWorld a) then (StateT RealWorld m a) is more or
> less the right thing?
But IO is not ST RealWorld (even if GHC pretends it is): other users
of the world are not waiting for the new world produced by your Haskell
program.
IO is more accurately modelled by a resumption monad, cf
http://www.haskell.org/pipermail/haskell-cafe/2003-August/004892.html
That suggests a possible monad transformer:
data IOT m a = Return a | Invoke (m (SysCall (IOT m a)))
but with no way to define runIOT :: Monad m => IOT m a -> IO (...),
it's not much use.
More information about the Haskell-Cafe
mailing list