
#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: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): This is more fall-out from the `Constraint` vs `Type` distinction. The kinding rules are {{{ ty : TYPE rep `a` is not free in rep (FORALL1) ----------------------- forall a. ty : TYPE rep ty : Constraint (FORALL2) ------------------------- forall a. ty : Constraint }}} How do we know which of these rules to use? Currently we do it by looking at the "expected kind", using `FORALL2` is the expected kind is `Constraint`. That's why it works if you give a kind signature. You could say "infer the kind of the body type, and use that to choose"; but that's vulnerable to exactly what constraints are solved when. Or perhaps you could do both. It's very uncomfortable having two different rules. I've often wondered about defining {{{ type Constraint = TYPE ConstraintRep }}} in which case one rule would do. Richard thinks this won't work but I forget why. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16139#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler