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

bob zhang bobzhang1988 at gmail.com
Wed Aug 24 05:17:11 CEST 2011


Hi,
  I think 3 < genericLength [1..] should fail, that laziness is not we
want.
  I can not derive ListLike  instance using GHC extensions, can you provide
a working example?
  Thanks
On Tue, Aug 23, 2011 at 9:47 PM, 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).
>
> > --- thank you for your nice library
> > btw, is there any way to derive ListLike interface automatically?
> > for such type :
> > newtype List a = List {[a]}
>
> GeneralizedNewtypeDeriving can do that.
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
>



-- 
Best, bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110823/e9ba5422/attachment.htm>


More information about the Haskell-Cafe mailing list