Discern that the following program is apparently well-typed:
module M2 where
class Eq a => Lattice a where
bottom :: a
data Inv a = INV a
deriving Eq
instance Lattice a => Lattice (Inv a)
class Holidays a where
holCode :: a -> Int
-- instance Holidays a => Eq a
Now, uncomment the last line, and suddenly:
ghc-4.02 -c M2.hs -H30m -K2M -recomp -fglasgow-exts -cpp -syslib misc
-Rgc-stats -dshow-passes -fmax-simplifier-iterations4
-funfolding-use-threshold-0 -optC-fallow-undecidable-instances
-optC-fallow-overlapping-instances
*** Reader:
*** Renamer:
*** TypeCheck:
M2.hs:9:
Warning: No explicit method nor default method for `bottom'
in an instance declaration for `Lattice'
M2.hs:9:
Could not deduce `Holidays a'
(arising from an instance declaration at M2.hs:9)
from the context: (Lattice a)
Probable cause: missing `Holidays a'
in instance declaration context
When checking the superclasses of an instance declaration
What gives? Even more oddly, if this last line is moved to a different
module, then the problem vanishes.
Slan libh,
Alex.