[GHC] #10451: Constraint tuple regression in HEAD

GHC ghc-devs at haskell.org
Fri May 29 20:48:10 UTC 2015


#10451: Constraint tuple regression in HEAD
-------------------------------------+-------------------------------------
        Reporter:  darchon           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |  ConstraintKinds
 Type of failure:  GHC rejects       |            Architecture:
  valid program                      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by adamgundry):

 * cc: adamgundry (added)


Comment:

 Oops! A possible workaround is to manually define an operator that gives
 nested pairs of constraints, like this:

 {{{
 type (x :: Constraint) :* (y :: Constraint) = (x, y)
 type ManyEq2 a = Eq a :* Eq a :* Eq a :* Eq a :* Eq a :* Eq a :* Eq a :*
 Eq a :* Eq a
 }}}

 Alternatively, a type family can be used to expand a list of constraints
 into nested pairs:

 {{{
 type family All (xs :: [Constraint]) :: Constraint where
   All '[]       = ()
   All (c ': cs) = (c, All cs)

 type ManyEq3 a = All '[Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq
 a]
 }}}

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


More information about the ghc-tickets mailing list