Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-06 Thread Esa Ilari Vuokko
Hi On 9/6/06, David Roundy <[EMAIL PROTECTED]> wrote: Fortunately, the undefined behavior in this case is unrelated to the lazy IO. On windows, the removal of the file will fail, while on posix systems there won't be any failure at all. The same behavior would show up if you opened the file fo

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-06 Thread David Roundy
On Fri, Sep 01, 2006 at 11:47:20PM +0100, Duncan Coutts wrote: > On Fri, 2006-09-01 at 17:36 -0400, Robert Dockins wrote: > > Well, AFAIK, the behavior is officially undefined, which is my > > real beef. I agree that it _should_ throw an exception. > > Ah, I had thought it was defined to simply t

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Donn Cave
Quoth Julien Oster <[EMAIL PROTECTED]>: ... | But what happens when two processes use the same file and one process is | writing into it using lazy IO which didn't happen yet? The other process | wouldn't see its changes yet. That's actually a much more general problem, one that I imagine applies

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Julien Oster
Duncan Coutts wrote: Hi, > In practise I expect that most programs that deal with file IO strictly > do not handle the file disappearing under them very well either. At best > the probably throw an exception and let something else clean up. And at least in Unix world, they just don't disappear.

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Duncan Coutts
On Fri, 2006-09-01 at 17:36 -0400, Robert Dockins wrote: > Perhaps I should be more clear. When I said "advanced" above I meant "any > use > whereby you treat a file as random access, read/write storage, or do any kind > of directory manipulation (including deleting and or renaming files)". L

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Robert Dockins
On Friday 01 September 2006 18:01, Donn Cave wrote: > On Fri, 1 Sep 2006, Robert Dockins wrote: > > On Friday 01 September 2006 16:46, Duncan Coutts wrote: > > ... > > >> Note also, that with lazy IO we can write really short programs that are > >> blindingly quick. Lazy IO allows us to save a copy

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Donn Cave
On Fri, 1 Sep 2006, Robert Dockins wrote: > On Friday 01 September 2006 16:46, Duncan Coutts wrote: ... >> Note also, that with lazy IO we can write really short programs that are >> blindingly quick. Lazy IO allows us to save a copy through the Handle >> buffer. (Never understood why some people

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Robert Dockins
On Friday 01 September 2006 16:46, Duncan Coutts wrote: > On Fri, 2006-09-01 at 16:28 -0400, Robert Dockins wrote: > > On Friday 01 September 2006 15:19, Tamas K Papp wrote: > > > Hi, > > > > > > I am newbie, reading the Gentle Introduction. Chapter 7 > > > (Input/Output) says > > > > > > Pragma

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Duncan Coutts
On Fri, 2006-09-01 at 16:28 -0400, Robert Dockins wrote: > On Friday 01 September 2006 15:19, Tamas K Papp wrote: > > Hi, > > > > I am newbie, reading the Gentle Introduction. Chapter 7 > > (Input/Output) says > > > > Pragmatically, it may seem that getContents must immediately read an > > ent

Re: [Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Robert Dockins
On Friday 01 September 2006 15:19, Tamas K Papp wrote: > Hi, > > I am newbie, reading the Gentle Introduction. Chapter 7 > (Input/Output) says > > Pragmatically, it may seem that getContents must immediately read an > entire file or channel, resulting in poor space and time performance > und

[Haskell-cafe] getContents and lazy evaluation

2006-09-01 Thread Tamas K Papp
Hi, I am newbie, reading the Gentle Introduction. Chapter 7 (Input/Output) says Pragmatically, it may seem that getContents must immediately read an entire file or channel, resulting in poor space and time performance under certain conditions. However, this is not the case. The key point