
14 May
2010
14 May
'10
9:33 a.m.
Hi Julian Variations of this one come up quite often, in a nutshell the typechecker doesn't use the instance context in the way you are expecting:
instance (Prelude.Num x) => Num x x x where ^^^^^^^^^^^^^^^ instance context
GHC takes less notice of the context than you might expect. Quite how much notice it takes I'm finding had to establish from section 7.6 of the user guide (Section 7.6.3.4. - Overlapping instances - appears to indicate it might even take none, though maybe my reading is missing something). Hopefully someone else will provide a definitive answer soon. http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/type-class-extension... Best wishes Stephen