failure to check completeness in instance declarations
Ross Paterson
ross@soi.city.ac.uk
Fri, 21 Mar 2003 19:22:54 +0000
On Fri, Mar 21, 2003 at 10:37:59AM -0800, Andrew Tolmach wrote:
> The following file is accepted by hugs (Nov.02 version on linux) without
> complaint.
>
> data Foo a = Foo a
>
> instance Eq (Foo a) where
>
> z = Foo 1 == Foo 2
Incomplete instances are legal in Haskell 98, but this one isn't,
because (==) has a default definition:
class Eq a where
(==), (/=) :: a -> a -> Bool
x /= y = not (x == y)
x == y = not (x /= y)
> Attempting to evaluate z causes a Segmentation fault (not unreasonably,
> perhaps!).
Segmentation fault is the Hugs implementation of stack overflow :-(