[GHC] #9151: Recursive default associated types don't kind-generalize properly

GHC ghc-devs at haskell.org
Fri Jun 6 13:19:15 UTC 2014


#9151: Recursive default associated types don't kind-generalize properly
-------------------------------------+------------------------------------
        Reporter:  goldfire          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------
Changes (by archblob):

 * cc: simonpj (added)


Comment:

 I'm adding simonpj, maybe he can chime in.

 I'm writing again as documentation.
 I've been looking into the result of the dependency analysis done in
 `depAnalTyClDecls`
 and we have :
 {{{
   REC
     type TEHelper = ToEnum Int

     class PEnum (k :: a) where
       type family ToEnum (x :: a) :: *
       type instance ToEnum x = TEHelper
 }}}

 which means we will try to check `TEHelper` before we generalize `ToEnum`
 and hence the kind check error.

 Braking the cycle and having:
 {{{
   REC
     class PEnum (k :: a) where
       type family ToEnum (x :: a) :: *
       type instance ToEnum x = TEHelper

   NOREC
     type TEHelper = ToEnum Int
 }}}
 will only work if we defer default type instance checking as you
 suggested. These modifications have to go together. But they really fell
 hackish.

 One other thing that I don't know if we can do is somehow accommodate for
 this by tweaking the four steps in `kcTyClGroup` , I'll be looking into
 how to do that as an alternative and compare the two.

 Am I making sense ?

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


More information about the ghc-tickets mailing list