Change History (13)

Fix #8884.
There were two unrelated errors fixed here:
1) Make sure that only the *result kind* is reified when reifying
a type family. Previously, the whole kind was reified, which
defies the TH spec.
2) Omit kind patterns in equations.

The fix affects open type families as well as closed. Both families had exactly the same mis-behavior, upon inspection of the code.

Given that, it's unclear to me whether this should be merged. The old behavior was clearly wrong -- for example, reifying a type family and then trying to splice it would end in failure. But, the old behavior was also quite reliable, and it's conceivable that users have noticed the poor behavior and have coded against it. (In fact, a co-author of one of my libraries has done just that, which is how I discovered the GHC bug!)

So, we must choose between

Retaining the incorrect behavior (which has been around for some time), while not surprising users in the final 7.8 release, or

Having correct behavior.

I slightly favor the latter, believing that this error was so egregious that no one (other than me, evidently) is using this feature of GHC. If anyone else were using the feature, we would have seen the bug report!

So, I'm setting this ticket to merge but am happy to have others disagree about that decision.

Note that the incorrect behavior applied to open type families as well as closed, so this isn't a new bug in 7.8. How could they use it constructively? Reifying a type family gives the list of arguments and the result kind. By counting the number of arguments, a program could remove the same number of arrows from the returned kind to get the actual result kind. It's not too hard, actually. As for the extra kind parameters, I suppose a program could do dependency analysis to discover which variables are kind variables and remove them.

In any case, my library (a branch of singletons) was able to use the incorrect behavior without too much trouble (once we figured out what was going on), so there's an evidence proof for you. :)