On Tue, 2008-01-22 at 07:45 -0200, Felipe Lessa wrote:
> 2008/1/22 Magnus Therning <[EMAIL PROTECTED]>:
> > I vaguely remember that in GHC 6.6 code like this
> >
> >   length $ map ord "a string"
> >
> > being able able to generate a different answer than
> >
> >   length "a string"
> 
> I guess it's not very difficult to prove that
> 
>      ∀ f xs.  length xs == length (map f xs)
> 
> even in the presence of seq.

This is the free theorem of length.  For it to be wrong, parametric
polymorphism would have to be incorrectly implemented.  Even seq makes
no difference (in this case.)

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to