[Haskell-cafe] Why no IO transformer monad?
k.schupke at imperial.ac.uk
Mon Dec 20 10:17:24 EST 2004
Okay but we have:
ST s a
runState :: State s a -> (a,s)
runST :: (forall s . ST s a) -> a -- notice no "s" in the return
so what about:
runSTT :: (forall s . ST s m a) -> m a -- no s gets out (like
with ST not State)
After all there was the proposal to merge (IO a) and (StateT RealWorld a)
Udo Stenzel wrote:
runSTT :: Monad m => STT s m a -> m (a,s)
>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