
22 Jan
2008
22 Jan
'08
11:35 a.m.
On Tue, 2008-01-22 at 07:45 -0200, Felipe Lessa wrote:
2008/1/22 Magnus Therning
: 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.)