DatatypeContexts should be fixed, not deprecated
|Reported by:||gidyn||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
To borrow an example from the prime wiki page, the following code fails to compile:
data Eq a => Foo a = Foo a isEq :: Foo a -> Foo a -> Bool isEq (Foo x) (Foo y) = x == y
We have to tell the compiler that
Eq a => Foo a in
isEq, even though this is part of the data type's definition. Furthermore,
getVal :: Foo a -> a getVal (Foo x) = x
will also fail because of the missing constraint, even though it isn't used in the function's definition.
Rather than just deprecating the
DatatypeContexts extension, it should be "fixed" to remember the context wherever the data type is used.
Change History (25)
comment:1 follow-up: 5 Changed 4 years ago by
|Status:||new → closed|