Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Udo Stenzel
Henning Sato von Rosen [EMAIL PROTECTED] schrieb am 18.12.04 18:31:11: For each basic monad there seems to be a corresponding transformer, e.g. 'StateT' for 'State' and so on. To be useful every transformer has a run method of some kind. For a hypothetical IO transformer it would look like

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Keean Schupke
What about: runIOT :: Monad m = IOT m a - IO (m a) Keean. Udo Stenzel wrote: Henning Sato von Rosen [EMAIL PROTECTED] schrieb am 18.12.04 18:31:11: For each basic monad there seems to be a corresponding transformer, e.g. 'StateT' for 'State' and so on. To be useful every transformer

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Keean Schupke
I thought you would get the following if you have a transformer 'M': runM :: M IO a - IO a to run 'M'... Keean. Udo Stenzel wrote: Keean Schupke [EMAIL PROTECTED] schrieb am 20.12.04 10:25:36: What about: runIOT :: Monad m = IOT m a - IO (m a) I have a gut feeling that this is

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Keean Schupke
Perhaps you would care to explain this then? class Runnable m n where run :: m - n class (Monad m,Monad (t m)) = MonadT t m where up :: m a - t m a down :: t m a - m a instance (Monad m,MonadT t m,Monad (t m)) = Runnable (t m a) (m a) where run = down Or

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Keean Schupke
Udo Stenzel wrote: Keean Schupke [EMAIL PROTECTED] schrieb am 20.12.04 14:20:54: Perhaps you would care to explain this then? Damn, I read a pair parens in there where there was none. The result still stands as is: no transformer version of IO is possible. But is that beacuse it really

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Tomasz Zielonka
On Mon, Dec 20, 2004 at 02:16:52PM +, 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

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Udo Stenzel
Keean Schupke [EMAIL PROTECTED] 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

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Ross Paterson
On Mon, Dec 20, 2004 at 02:16:52PM +, 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

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Keean Schupke
Okay but we have: ST s a and: runState :: State s a - (a,s) runST :: (forall s . ST s a) - a-- notice no s in the return type: 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)

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Keean Schupke
Ross Paterson wrote: On the haskell list it has almost been decided that (ST RealWorld a) and (IO a) _should_ merge and become the same thing. Keean. On Mon, Dec 20, 2004 at 02:16:52PM +, Keean Schupke wrote: Surely if IO is (ST RealWorld a) then (StateT RealWorld m a) is more or less

Re: [Haskell-cafe] Why no IO transformer monad?

2004-12-20 Thread Ben Rudiak-Gould
Ross Paterson wrote: 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. They're *part* of the world. IO = State RealWorld makes sense if you think of RealWorld as encapsulating the entire state of