Re: [Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-06 Thread Duncan Coutts
On Thu, 2009-03-05 at 13:08 +, Simon Marlow wrote: > Lennart Augustsson wrote: > > I don't see any breaking of referential transparence in your code. > > Every time you do an IO operation the result is basically > > non-deterministic since you are talking to the outside world. > > You're assumi

Re: [Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Brandon S. Allbery KF8NH
On 2009 Mar 5, at 8:08, Simon Marlow wrote: So the argument is something like: we can think of the result of a call to unsafeInterleaveIO as having been chosen at the time we called unsafeInterleaveIO, rather than when its result is actually evaluated. This is on dodgy ground, IMO: either yo

Re: [Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Gregg Reynolds
On Thu, Mar 5, 2009 at 7:08 AM, Simon Marlow wrote: > > So the argument is something like: we can think of the result of a call to > unsafeInterleaveIO as having been chosen at the time we called > unsafeInterleaveIO, rather than when its result is actually evaluated. This > is on dodgy ground, I

Re: [Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Svein Ove Aas
On Thu, Mar 5, 2009 at 2:08 PM, Simon Marlow wrote: > > So the argument is something like: we can think of the result of a call to > unsafeInterleaveIO as having been chosen at the time we called > unsafeInterleaveIO, rather than when its result is actually evaluated. This > is on dodgy ground, IM

Re: [Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Jonathan Cast
On Thu, 2009-03-05 at 13:08 +, Simon Marlow wrote: > Lennart Augustsson wrote: > > I don't see any breaking of referential transparence in your code. > > Every time you do an IO operation the result is basically > > non-deterministic since you are talking to the outside world. > > You're assumi

Re: [Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Lennart Augustsson
You're assuming that IO operations have semantics. >From the Haskell program's point of view, and when reasoning about Haskell programs (not their interaction with the world) you should assume that every IO operation returns a random result. The way Oleg's program behaves does not break RT under t

[Haskell-cafe] Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Simon Marlow
Lennart Augustsson wrote: I don't see any breaking of referential transparence in your code. Every time you do an IO operation the result is basically non-deterministic since you are talking to the outside world. You're assuming the IO has some kind of semantics that Haskell makes no promises abo