Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-06 Thread Henning Thielemann
Daniel Fischer schrieb: On Sunday 05 September 2010 21:52:44, Henning Thielemann wrote: Daniel Fischer schrieb: Yes. Ordinarily, lines in text files aren't longer than a few hundred characters, leaking those, who cares? I got several space leaks of this kind in the past. They are very

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-06 Thread Daniel Fischer
On Monday 06 September 2010 10:47:54, Henning Thielemann wrote: Daniel Fischer schrieb: On Sunday 05 September 2010 21:52:44, Henning Thielemann wrote: Daniel Fischer schrieb: Yes. Ordinarily, lines in text files aren't longer than a few hundred characters, leaking those, who cares? I

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-05 Thread Daniel Fischer
On Saturday 04 September 2010 00:21:39, Jan Christiansen wrote: On 03.09.2010, at 14:38, Daniel Fischer wrote: I can't reproduce that. For me, it leaks also with profiling. Have you used optimizations? Of course. Always do :) It disappears if I compile the program with -O2. Yeah, without

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-05 Thread Henning Thielemann
Daniel Fischer schrieb: Yes. Ordinarily, lines in text files aren't longer than a few hundred characters, leaking those, who cares? I got several space leaks of this kind in the past. They are very annoying. They are especially annoying if input comes from the outside world, where people can

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-05 Thread Daniel Fischer
On Sunday 05 September 2010 21:52:44, Henning Thielemann wrote: Daniel Fischer schrieb: Yes. Ordinarily, lines in text files aren't longer than a few hundred characters, leaking those, who cares? I got several space leaks of this kind in the past. They are very annoying. They are

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-04 Thread Albert Y. C. Lai
On 10-09-03 06:11 AM, Henning Thielemann wrote: Yes, something this way. () suggests a notion of magnitude for me, which some orderings do not have. Like for example -1000 has a larger magnitude than -0.0001, therefore you also reject the common ordering -1000 -0.0001?

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-03 Thread Henning Thielemann
Ivan Lazar Miljenovic schrieb: On 3 September 2010 04:57, Arie Peterson ar...@xs4all.nl wrote: On Thu, 2 Sep 2010 19:30:17 +0200, Daniel Fischer daniel.is.fisc...@web.de wrote: Why would one consider using Ord for Map an abuse? A kludge, for performance reasons, but an abuse? Because it

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-03 Thread Neil Brown
On 03/09/10 11:11, Henning Thielemann wrote: Ivan Lazar Miljenovic schrieb: On 3 September 2010 04:57, Arie Peterson ar...@xs4all.nl wrote: On Thu, 2 Sep 2010 19:30:17 +0200, Daniel Fischer daniel.is.fisc...@web.de wrote: Why would one consider using Ord for Map an abuse? A kludge, for

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-03 Thread Arie Peterson
On Fri, 3 Sep 2010 12:02:22 +1000, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: What precisely do you mean by natural ordering? An ordering that has relevant meaning for the information represented by the datatype. Ideally, it should also be alone in being the order anyone would expect

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-03 Thread Daniel Fischer
On Friday 03 September 2010 12:28:43, Jan Christiansen wrote: Hi, On 03.09.2010, at 01:32, Daniel Fischer wrote: No surprise, there aren't many 'ä's in Shakespeare's works, are there? nope On the other hand, the current implementation of lines does not seem to suffer from Wadler's

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-03 Thread Jan Christiansen
On 03.09.2010, at 14:38, Daniel Fischer wrote: I can't reproduce that. For me, it leaks also with profiling. Have you used optimizations? It disappears if I compile the program with -O2. Without profiling I get the following. Here the maximum residency is nearly 45MB. $ ghc --make

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Jan Christiansen
Hi, On 02.09.2010, at 01:35, Daniel Fischer wrote: It's not that it's not as non-strict as possible per se. (Sorry, had to :) It's that intersperse's current definition (in GHC at least) can cause a space leak. In this case, making the function less strict can cure it, in other cases,

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Daniel Fischer
On Thursday 02 September 2010 09:25:59, Jan Christiansen wrote: Hi, On 02.09.2010, at 01:35, Daniel Fischer wrote: It's not that it's not as non-strict as possible per se. (Sorry, had to :) It's that intersperse's current definition (in GHC at least) can cause a space leak. In this

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Henning Thielemann
Jan Christiansen schrieb: Hi, On 02.09.2010, at 01:35, Daniel Fischer wrote: It's not that it's not as non-strict as possible per se. (Sorry, had to :) It's that intersperse's current definition (in GHC at least) can cause a space leak. In this case, making the function less strict can

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Stephen Sinclair
On Thu, Sep 2, 2010 at 3:25 AM, Jan Christiansen j...@informatik.uni-kiel.de wrote: I prefer  False = _|_ = True Sorry to go a bit off topic, but I find it funny that I never really noticed you could perform less-than or greater-than comparisons on Bool values. What's the semantic reasoning

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Henning Thielemann
On Thu, 2 Sep 2010, Stephen Sinclair wrote: On Thu, Sep 2, 2010 at 3:25 AM, Jan Christiansen j...@informatik.uni-kiel.de wrote: I prefer  False = _|_ = True Sorry to go a bit off topic, but I find it funny that I never really noticed you could perform less-than or greater-than comparisons

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Neil Brown
On 02/09/10 17:10, Stephen Sinclair wrote: On Thu, Sep 2, 2010 at 3:25 AM, Jan Christiansen j...@informatik.uni-kiel.de wrote: I prefer False= _|_ = True Sorry to go a bit off topic, but I find it funny that I never really noticed you could perform less-than or greater-than

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Daniel Fischer
On Thursday 02 September 2010 18:25:11, Henning Thielemann wrote: The Ord instance for Bool might be justified for using Bools as keys of Data.Map, however you can also consider using Ord for Map as abuse. Why would one consider using Ord for Map an abuse? A kludge, for performance reasons, but

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Albert Y. C. Lai
On 10-09-02 12:10 PM, Stephen Sinclair wrote: Sorry to go a bit off topic, but I find it funny that I never really noticed you could perform less-than or greater-than comparisons on Bool values. What's the semantic reasoning behind allowing relative comparisons on booleans? In what context

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Arie Peterson
On Thu, 2 Sep 2010 19:30:17 +0200, Daniel Fischer daniel.is.fisc...@web.de wrote: Why would one consider using Ord for Map an abuse? A kludge, for performance reasons, but an abuse? Because it forces one to declare Ord instances for types which have no natural ordering. It is useful to *not*

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Jan Christiansen
Hi, On 02.09.2010, at 13:41, Daniel Fischer wrote: takes a little to run and keeps the entire file until the first occurrence of pat in memory. first of all thanks very much for the detailed instructions. I have rewritten the example slightly using Strings instead of Bytestrings.

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Daniel Fischer
On Friday 03 September 2010 00:22:14, Jan Christiansen wrote: Hi, On 02.09.2010, at 13:41, Daniel Fischer wrote: takes a little to run and keeps the entire file until the first occurrence of pat in memory. first of all thanks very much for the detailed instructions. I have rewritten

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Alexander Solla
On Sep 2, 2010, at 9:10 AM, Stephen Sinclair wrote: Sorry to go a bit off topic, but I find it funny that I never really noticed you could perform less-than or greater-than comparisons on Bool values. What's the semantic reasoning behind allowing relative comparisons on booleans? In what

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Ivan Lazar Miljenovic
On 3 September 2010 04:57, Arie Peterson ar...@xs4all.nl wrote: On Thu, 2 Sep 2010 19:30:17 +0200, Daniel Fischer daniel.is.fisc...@web.de wrote: Why would one consider using Ord for Map an abuse? A kludge, for performance reasons, but an abuse? Because it forces one to declare Ord instances

[Haskell-cafe] Unnecessarily strict implementations

2010-09-01 Thread Jan Christiansen
Hi, there is a new ticket that Data.List.intersperse is not as non-strict as possible (http://hackage.haskell.org/trac/ghc/ticket/4282). I have observed some other functions which are unnecessarily strict and it might be advantageous to change their definitions as well. I think it is

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-01 Thread Daniel Fischer
On Thursday 02 September 2010 00:05:03, Jan Christiansen wrote: Hi, there is a new ticket that Data.List.intersperse is not as non-strict as possible (http://hackage.haskell.org/trac/ghc/ticket/4282). It's not that it's not as non-strict as possible per se. (Sorry, had to :) It's that