GHC 7.4+ thinks class instance is incoherent, 7.0.4 disagrees
Load this file into GHCi:
With v7.4 (and HEAD) I get:
GHCi, version 7.5.20120410: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling TypeMachinery ( TypeMachinery.lhs, interpreted ) TypeMachinery.lhs:78:23: Overlapping instances for Show (Nat' (Plus n n1)) arising from a use of `Hide' Matching instances: instance Show (Nat' a) -- Defined at TypeMachinery.lhs:24:3 There exists a (perhaps superclass) match: from the context (Show (Nat' n)) bound by a pattern with constructor Hide :: forall (a :: * -> *) n. Show (a n) => a n -> Hidden a, in an equation for `+' at TypeMachinery.lhs:78:5-10 or from (Show (Nat' n1)) bound by a pattern with constructor Hide :: forall (a :: * -> *) n. Show (a n) => a n -> Hidden a, in an equation for `+' at TypeMachinery.lhs:78:14-19 (The choice depends on the instantiation of `n, n1' To pick the first instance above, use -XIncoherentInstances when compiling the other instance declarations) In the expression: Hide In the expression: Hide $ plus a b In an equation for `+': (Hide a) + (Hide b) = Hide $ plus a b Failed, modules loaded: none.
With 7.0.4 all compiles (and runs) correctly.