Re: [Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-04 Thread Henning Thielemann
On Sat, 3 Jan 2009, Henning Thielemann wrote: I think I now have general Applicative functionality ... I hope the following is a proper Monad implementation. In contrast to Applicative a Writer for sequencing actions does no longer work, instead I need a State monad. newtype LazyIO a =

Re: [Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-03 Thread Henning Thielemann
On Thu, 1 Jan 2009, Brandon S. Allbery KF8NH wrote: On 2009 Jan 1, at 16:44, Henning Thielemann wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow the definition of a general lazy IO monad? I thought

Re: [Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-03 Thread Henning Thielemann
On Sat, 3 Jan 2009, Henning Thielemann wrote: On Thu, 1 Jan 2009, Brandon S. Allbery KF8NH wrote: On 2009 Jan 1, at 16:44, Henning Thielemann wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow the definition of

[Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Henning Thielemann
I think I have a very similar problem to the currently discussed WriterT [w] IO is not lazy in reading [w]. I want to defer IO actions, until they are needed, but they shall be executed in order. If I call unsafeInterleaveIO, they can be executed in any order. I understand that hGetContents does

Re: [Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Brandon S. Allbery KF8NH
On 2009 Jan 1, at 16:44, Henning Thielemann wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow the definition of a general lazy IO monad? I thought unsafeInterleaveIO and users of it (readFile, hGetContents)