failure to check completeness in instance declarations
The following file is accepted by hugs (Nov.02 version on linux) without complaint. Attempting to evaluate z causes a Segmentation fault (not unreasonably, perhaps!). As far as I can tell, completeness is never being checked statically. Sometimes it is successfully checked dynamically and causes an "Undefined member" error. ----------- data Foo a = Foo a instance Eq (Foo a) where z = Foo 1 == Foo 2 ---------------
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 :-(
participants (2)
-
Andrew Tolmach -
Ross Paterson