[Haskell-cafe] Why no IO transformer monad?
Tomasz Zielonka
tomasz.zielonka at gmail.com
Mon Dec 20 09:27:31 EST 2004
On Mon, Dec 20, 2004 at 02:16:52PM +0000, Keean Schupke wrote:
> But is that beacuse it really isn't (theoretically) possible, or just
> not possible
> to write in Haskell (because it would involve new primitives)?
>
> Surely if IO is (ST RealWorld a) then (StateT RealWorld m a) is more or
> less the
> right thing?
Sure, you only need to implement one primitive - world duplication ;)
Consider m = []:
Prelude Control.Monad.State> runStateT (do x <- lift [1,2,3]; put x) 0
[((),1),((),2),((),3)]
Prelude Control.Monad.State> runIOT (do x <- lift [1,2,3]; print x) 0
hmmm?
Best regards,
Tomasz
More information about the Haskell-Cafe
mailing list