How do I make a constraint tuple in Core?

Ryan Scott at
Tue Jun 19 13:53:20 UTC 2018

I'm currently working on some code in which I need to produce a Core Type
that mentions a constraint tuple. I thought that there must surely exist
some way to construct a constraint tuple using the GHC API, but to my
astonishment, I could not find anything. The closest thing I found was
mk_tuple [1], which gives you the ability to make boxed and unboxed tuples,
but not constraint tuples.

I then thought to myself, "But wait, PartialTypeSignatures has to create
constraint tuples, right? How does that part of the code work?" To my
horror, I discovered that PartialTypeSignatures actually creates *boxed*
tuples (see mk_ctuple here [2]), then hackily treats them as constraint
tuples, as explained in Note [Extra-constraint holes in partial type
signatures] [3]. I tried reading that Note, but I couldn't follow the

Is there a simpler way to create a constraint tuple that I'm not aware of?

Ryan S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list