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

#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 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider {{{ 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 instantation of `t1` in the argument of `show`. I'm fixing this, but I wanted to make a ticket to exhibit it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12644 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#12644: Lack of instantiation in GHC 8.0.1
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| typecheck/should_compile/T12644
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by simonpj):
* status: new => closed
* testcase: => typecheck/should_compile/T12644
* resolution: => fixed
Comment:
Fixed as part of
{{{
commit b612da667fe8fa5277fc78e972a86d4b35f98364
Author: Simon Peyton Jones
participants (1)
-
GHC