[Haskell-cafe] context deduction in GHC

Doug McIlroy doug at cs.dartmouth.edu
Tue Sep 30 17:52:54 UTC 2014


Why does ghci 7.6.3 not like this example, which section
4.3.2 of the language definition says is valid Haskell?

class Foo a
class Foo a => Bar a
instance (Eq a, Show a) => Foo [a]
instance Num a => Bar [a]

Ghci complains, "Could not deduce (Show a) arising from
the superclasses of an instance declaration from the
context (Num a)". Yet Show is a superclass of Num.
Hugs accepts the code.

Doug McIlroy


More information about the Haskell-Cafe mailing list