[GHC] #16139: GHC confused about type synonym kind with QuantifiedConstraints

GHC ghc-devs at haskell.org
Tue Jan 8 15:17:41 UTC 2019


#16139: GHC confused about type synonym kind with QuantifiedConstraints
-------------------------------------+-------------------------------------
        Reporter:  Ashley Yakeley    |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11621, #11715,   |  Differential Rev(s):
  #13742, #16148                     |
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 `type Constraint = TYPE ConstraintRep` won't work because levity-
 polymorphic functions would have an unknowable number of explicit
 arguments. Take something like `absX :: forall (r :: RuntimeRep) (a ::
 TYPE r). NumX a => a -> a`. (This is possible if `NumX` is levity
 polymorphic.) How many explicit arguments does `absX` take? It depends on
 the choice of `r`, because what looks like the one explicit argument
 becomes implicit if `r` is `ConstraintRep`. Even worse, this function
 would ''return'' a constraint, something we don't currently allow for
 normal functions.

 What would work is `type Constraint = TYPE LiftedRep YesIsConstraint`,
 where we index `TYPE` by yet another flag. That's the most principled
 answer here, but it seems like using a sledgehammer to tap in a nail.

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


More information about the ghc-tickets mailing list