maximum [] complains about an empty list

"Neil Mitchell" <[email protected]> Fri, 24 Nov 2006 03:09:13 +0000
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
Hi,

In GHC:
Prelude> maximum []
*** Exception: Prelude.maximum: empty list

In Hugs:
Prelude> maximum []
Program error: pattern match failure: foldl1 (Ord_max instOrd_v29) []

Obviously this is because foldl1 is used to define maximum, but it
would be nice if the equation maximum [] = error "pattern match
failure in maximum" was issued, otherwise people might end up grepping
for foldl1 which doesn't ever occur in their code.

Thanks

Neil