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

GHC ghc-devs at haskell.org
Thu Jun 5 14:02:28 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:
-------------------------------------+------------------------------------

Comment (by goldfire):

 Looking at the code for a bit, I don't think this is a trivial fix, after
 all. The problem is that associated type defaults are type-checked in the
 same group as the enclosing class. This means that GHC thinks that
 `TEHelper` and `PEnum` are mutually recursive. Thus, polymorphic recursion
 is not allowed between them, which is what we're asking for here.

 Instead, GHC should type check associated type defaults with other
 instances (in `tcInstDecls1`, likely), ''after'' all !TyClGroups are done
 being checked. With that line-up, `TEHelper` depends on `ToEnum` (part of
 the group with `PEnum`), but not the other way around. Unfortunately, this
 requires some moving plumbing around, and is not something I have time for
 at the moment. This all is not unlike how default method declarations have
 to be checked quite separately from the rest of a class.

 Anyway, archblob, if you want to keep playing, perhaps my comments above
 are helpful. I don't think this is ''hard'', but I originally thought the
 problem was due to a small oversight in the dependency analysis in the
 renamer. That's not the case, but it shouldn't be more than an hour or two
 of work.

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


More information about the ghc-tickets mailing list