context deduction in GHC

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

Because believe it or not, Show is not a superclass of Num. Отправлено с iPad
30 сент. 2014 г., в 21:52, Doug McIlroy
написал(а): 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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, Sep 30, 2014 at 1:52 PM, Doug McIlroy
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.
Show used to be a superclass of Num. It's not in current ghc, and will probably be removed from the next version of the language standard. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (3)
-
Brandon Allbery
-
Doug McIlroy
-
MigMit