[GHC] #11962: Support induction recursion

GHC ghc-devs at haskell.org
Thu Nov 9 15:24:56 UTC 2017


#11962: Support induction recursion
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:  9269              |             Blocking:
 Related Tickets:  #13901            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by andrewthad):

 @goldfire To my understanding, the priority of this ticket is getting
 induction recursion supported for GADTs. I'm unclear on how the "same
 recursive subgroup" error in the example you gave is related to the "same
 recursive subgroup" error that I run into with typeclasses. For example:

 {{{
 class Grounded v where
   type Rep (a :: v) :: RuntimeRep
   type Lifted (a :: v) :: Type
   type Unlifted (a :: v) :: TYPE (Rep a)
   ... some methods in here as well
 }}}

 This currently errors with:

 {{{
 sorted_int_type.hs:100:35: error:
     • Type constructor ‘Rep’ cannot be used here
         (it is defined and used in the same recursive group)
     • In the first argument of ‘TYPE’, namely ‘(Rep a)’
       In the kind ‘TYPE (Rep a)’
     |
 100 |   type Unlifted (a :: v) :: TYPE (Rep a)
     |                                   ^^^
 }}}

 I have to split the class up:

 {{{
 class GroundSuper v where
   type Rep (a :: v) :: RuntimeRep
 class GroundSuper v => Grounded v where
   type Lifted (a :: v) :: Type
   type Unlifted (a :: v) :: TYPE (Rep a)
 }}}

 It's not the worst thing ever, but it's kind of silly that what really is
 logically one typeclass needs to be split up into two typeclasses. It's
 not totally clear to me if this is really even the same issue as what you
 describe above or if fixing one automatically fixes the other, but it
 gives the same error message, which leads me to believe that they are
 somehow related.

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


More information about the ghc-tickets mailing list