[GHC] #9359: Deriving clause failure with polymorphic kinds

#9359: Deriving clause failure with polymorphic kinds -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Consider {{{ {-# Language GADTs, PolyKinds, TypeFamilies, DataKinds #-} module Fam where data Cmp a where Sup :: Cmp a V :: a -> Cmp a deriving (Show, Eq) data family CmpInterval (a :: Cmp k) (b :: Cmp k) :: * data instance CmpInterval (V c) Sup = Starting c deriving( Show ) }}} GHC 7.8.3 gives {{{ Fam.hs:12:13: Can't make a derived instance of ‘Show (CmpInterval ('V c) 'Sup)’: No family instance for ‘CmpInterval ('V c) 'Sup’ In the data instance declaration for ‘CmpInterval’ }}} which is obviously wrong. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9359 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9359: Deriving clause failure with polymorphic kinds -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Description changed by simonpj: Old description:
Consider {{{ {-# Language GADTs, PolyKinds, TypeFamilies, DataKinds #-} module Fam where
data Cmp a where Sup :: Cmp a V :: a -> Cmp a deriving (Show, Eq)
data family CmpInterval (a :: Cmp k) (b :: Cmp k) :: * data instance CmpInterval (V c) Sup = Starting c deriving( Show ) }}} GHC 7.8.3 gives {{{ Fam.hs:12:13: Can't make a derived instance of ‘Show (CmpInterval ('V c) 'Sup)’: No family instance for ‘CmpInterval ('V c) 'Sup’ In the data instance declaration for ‘CmpInterval’ }}} which is obviously wrong.
New description: Consider {{{ {-# Language GADTs, PolyKinds, TypeFamilies, DataKinds #-} module Fam where data Cmp a where Sup :: Cmp a V :: a -> Cmp a deriving (Show, Eq) data family CmpInterval (a :: Cmp k) (b :: Cmp k) :: * data instance CmpInterval (V c) Sup = Starting c deriving( Show ) }}} GHC 7.8.3 gives {{{ Fam.hs:12:13: Can't make a derived instance of ‘Show (CmpInterval ('V c) 'Sup)’: No family instance for ‘CmpInterval ('V c) 'Sup’ In the data instance declaration for ‘CmpInterval’ }}} which is obviously wrong. Reported on [http://www.haskell.org/pipermail/glasgow-haskell- users/2014-July/025145.html glasgow-haskell-users]. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9359#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9359: Deriving clause failure with polymorphic kinds -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T9359 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * cc: cheater00@… (added) * testcase: => deriving/should_compile/T9359 Comment: Great bug report, thank you. For good reasons, processing the `deriving` clause is well separated from other processing of the `data instance` declaration. Making kind arguments explicit, the latter gives {{{ data instance CmpInterval * (V (c::*)) Sup = Starting c }}} that is, this only applies at kind `*`, because the RHS says that `c::*`. But when processing the `deriving` clause we were forgetting to kind-check the RHS, so we were trying to derive an instance for `Show (CmpInterval k (V (c::k)) Sup`; and indeed there isn't one. Fix coming. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9359#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9359: Deriving clause failure with polymorphic kinds
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: | Blocked By:
None/Unknown | Related Tickets:
Test Case: |
deriving/should_compile/T9359 |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#9359: Deriving clause failure with polymorphic kinds -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T9359 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => merge Comment: Merge to 7.8.4 if we ever release such a thing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9359#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9359: Deriving clause failure with polymorphic kinds -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T9359 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by cheater): * cc: cheater00@… (removed) * cc: cheater (added) Comment: Thank you very much, this is why GHC is so great! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9359#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9359: Deriving clause failure with polymorphic kinds -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | deriving/should_compile/T9359 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed * milestone: => 7.10.1 Comment: This one is a bit tricky to merge due to several other major changes touching `TcDeriv.lhs`, so I'm afraid this one will be left out of 7.8.4. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9359#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC