Lack of instantiation in GHC 8.0.1
Consider
{-# LANGUAGE ImpredicativeTypes #-}
data T a = T1 Int
instance Show (T a) where
show (T1 x) = show x
t1 :: T a
t1 = T1 1
f :: String
f = show t1
This should typecheck fine. The a
in data type T
is phantom, but we often use phantom types.
But it isn't with GHC 8.0.1:
• No instance for (Show (forall a. T a))
arising from a use of ‘show’
• In the expression: show t1
In an equation for ‘f’: f = show t1
The problem is in the lack of instantiation of t1
in the argument of show
.
Admittedly it only happens with -XImpredicativeTypes
, but that flag should never make a legal program fail!
I'm fixing this, but I wanted to make a ticket to exhibit it.