
This code causes GHC to incorrectly fail - the case *is* reachable. (I invented this technique in an attempt to directly access the internal System FC newtype coercion; it promised until a few minutes ago to solve all the EnumMap performance concerns.) stefan@stefans:/tmp$ cat A.lhs
{-# OPTIONS_GHC -fglasgow-exts #-}
data IsIntT x where IsIntT :: IsIntT Int
class IsIntC a where isInt :: IsIntT a instance IsIntC Int where isInt = IsIntT
newtype Foo = Foo Int deriving(IsIntC)
x :: IsIntT Foo -> Int x IsIntT = (Foo 2) + 2
y = x (isInt :: IsIntT Foo) stefan@stefans:/tmp$ ghci -v0 A.lhs
A.lhs:11:4: Inaccessible case alternative: Can't match types `Foo' and `Int' In the pattern: IsIntT In the definition of `x': x IsIntT = (Foo 2) + 2 Stefan