On Mon, Aug 19, 2002 at 11:34:48PM +0100, Alastair Reid wrote: > > > main = print $ sum [0..1000000] > ... > Hugs uses foldl' instead of foldl to define sum:...
Does it really? That's a violation of the standard: a user's instance
of (+) need not be strict in its left argument. Consider
> data Foo = Foo Integer deriving (Eq, Show)
> instance Num Foo where
> fromInteger = Foo
> a + b = b
> v1 = undefined + Foo 2
> v2 = sum [undefined, Foo 2]
Both v1 and v2 should have the value 'Foo 2'. However, hugs (December
2001) gives
Program error: {undefined}
in response to v2. ghci gets it right.
--Dylan
msg11397/pgp00000.pgp
Description: PGP signature
