[GHC] #12644: Lack of instantiation in GHC 8.0.1

GHC ghc-devs at haskell.org
Fri Sep 30 09:07:29 UTC 2016


#12644: Lack of instantiation in GHC 8.0.1
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by simonpj:

@@ -3,0 +3,2 @@
+ {-# LANGUAGE ImpredicativeTypes #-}
+
@@ -24,1 +26,1 @@
- The problem is in the lack of instantation of `t1` in the argument of
+ The problem is in the lack of instantiation of `t1` in the argument of
@@ -27,0 +29,3 @@
+ Admittedly it only happens with `-XImpredicativeTypes`, but that flag
+ should never make a legal program fail!
+

New description:

 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.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12644#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list