Inferring from context declarations
Wed, 21 Feb 2001 15:48:57 +0100
I'm sorry if this is a FAQ, but I'm curious to know why Haskell (or at least, GHC and Hugs)
doesn't seem able to use contexts on variables at the front of data declarations. For
example the following
data Eq x => Foo x = Foo x
equal :: Foo x -> Foo x -> Bool
equal (Foo x1) (Foo x2) = (x1==x2)
provokes an error when I try to compile it with both GHC and Hugs.
So if there is a reason, what is it? If not, is it on the list of things to fix?
I can't say that it's a major inconvenience, it just means that when I use a
type like Foo I have to put totally pointless extra context declarations in.