[Haskell-cafe] Has character changed in GHC 6.8?

Derek Elkins derek.a.elkins at gmail.com
Tue Jan 22 11:35:14 EST 2008


On Tue, 2008-01-22 at 07:45 -0200, Felipe Lessa wrote:
> 2008/1/22 Magnus Therning <magnus at therning.org>:
> > 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.)



More information about the Haskell-Cafe mailing list