[Haskell-cafe] Why no IO transformer monad?

Udo Stenzel u.stenzel at web.de
Mon Dec 20 09:33:49 EST 2004

Keean Schupke <k.schupke at imperial.ac.uk> schrieb am 20.12.04 15:17:14:

> Surely if IO is (ST RealWorld a) then (StateT RealWorld m a) is more or 
> less the right thing?

Not at all, since ST and StateT are completely unrelated.  What signature would
runSTT have?  Either it exposed the contained state (the RealWorld!):

runSTT :: Monad m => STT s m a -> m (a,s)

or it drops the state:

runSTT :: Monad m => STT s m a -> m a

The former is a bad idea, the latter is useless as it can be implemented by
running the ordinary runST inside m.  Note that runStateT uses the former
signature and would expose RealWorld, if it could be instantiated at RealWorld.


Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201

More information about the Haskell-Cafe mailing list