[Haskell-cafe] a minor bug (memory leak) in ListLike package

Sebastian Fischer fischer at nii.ac.jp
Wed Aug 24 07:54:14 CEST 2011


On Wed, Aug 24, 2011 at 10:47 AM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 24 August 2011 11:10, bob zhang <bobzhang1988 at gmail.com> wrote:
>> Hi, John, there is a space leak problem in ListLike typeclass,
>> in the method genericLength
>> calclen !accum cl =
>> calclen accum cl =
>
> I _think_ this may cause problems with some data types (e.g.
> http://hackage.haskell.org/packages/archive/numbers/2009.8.9/doc/html/Data-Number-Natural.html
> ) that require the extra laziness (that is, you can do things like ` 3
> < genericLength [1..] ' and have it return True).

Does the current version support this? The use of an accumulator (that
is presumably returned after consuming the complete input) seems to
suggest that your example would diverge anyway (but I did not try).

Sebastian



More information about the Haskell-Cafe mailing list