[GHC] #12500: Open Type Family Kind Resolution

GHC ghc-devs at haskell.org
Thu Aug 18 19:31:45 UTC 2016


#12500: Open Type Family Kind Resolution
-------------------------------------+-------------------------------------
           Reporter:  andrewthad     |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The following is a minimal example of this problem:

 {{{#!hs

 -- Section 1
 data Animal = Dog | Cat | Mouse
 data Planet = Earth | Jupiter | Mars | Saturn
 type family ToRes (k :: Type) = (j :: Type)
 type instance ToRes Planet = Animal

 -- Section 2
 type family Thing k (a :: k) = (b :: ToRes k)
 type instance Thing Planet 'Earth = 'Dog

 }}}

 The last line fails with:

 {{{
 Expected kind 'ToRes Planet', but 'Dog has kind Animal
 }}}

 What's weird is that, if I take the part labeled Section 1 and move it
 into another module and then import that module into one that contains
 Section 2, it compiles fine. In this minimal case, that's not a huge
 problem, but for my real use case, splitting the type instances into two
 modules like this forces me to use an orphan.

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


More information about the ghc-tickets mailing list