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

Sebastian Fischer fischer at nii.ac.jp
Fri Aug 26 10:50:58 CEST 2011

On Wed, Aug 24, 2011 at 3:47 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> I was just trying to remember some of the tricks Daniel Peebles (aka
> {co}pumpkin) used to do in #haskell with Data.List.genericLength.
> I've never really used ListLike, but was just trying to guess why the
> default implementation was as it is.

Maybe he used lazy implementations of Num and Ord in combination with
a definition like

    length [] = 0
    length (_:xs) = 1 + length xs

But as John observed, the accumulating version of length does not
provide such laziness and the accumulator might as well be made


More information about the Haskell-Cafe mailing list