Support wild cards in data/type family instances
ClosedPublic

Authored by thomasw on Jul 22 2015, 7:00 AM.

Details

Summary

Handle anonymous wild cards in type or data family instance declarations like
unnamed type variables. For instance (pun intented):

type family F (a :: *) (b :: *) :: *
type instance F Int _ = Int

Is now the same as:

type family F (a :: *) (b :: *) :: *
type instance F Int x = Int

Note that unlike wild cards in partial type signatures, no errors (or warnings
with -XPartialTypeSignatures) are generated for these wild cards, as there is
nothing interesting to report to the user, i.e. the inferred kind.

Only anonymous wild cards are supported here, named and extra-constraints wild
card are not.

Test Plan

pass new tests

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
thomasw retitled this revision from to Support wild cards in data/type family instances.Jul 22 2015, 7:00 AM
thomasw updated this object.
thomasw edited the test plan for this revision. (Show Details)
thomasw added reviewers: simonpj, goldfire.
thomasw updated the Trac tickets for this revision.
thomasw updated this revision to Diff 3634.Jul 22 2015, 7:10 AM

Rebase against master

thomasw updated this revision to Diff 3635.Jul 22 2015, 7:55 AM

Fix tests

simonpj requested changes to this revision.Jul 22 2015, 8:18 AM

Looks good.

Badly needs user-manual documentation! Including what flags (if any) are required. I think none.

Otherwise fine.

compiler/typecheck/TcTyClsDecls.hs
1033

Please give a Note with a concrete example or two; mention the ticket too.

This revision now requires changes to proceed.Jul 22 2015, 8:18 AM

Badly needs user-manual documentation! Including what flags (if any) are required. I think none.

Absolutely. Should I put this in the user manual section on partial type signatures? I'll mention this in the release notes too.

No flags are needed indeed.

Absolutely. Should I put this in the user manual section on partial type signatures? I'll mention this in the release notes too.

I'd put it in the section on type instance declarations, but add cross-references in both directions. It's not really a partial type signature at all!

No flags are needed indeed.

need to mention that

thomasw updated this revision to Diff 3636.Jul 22 2015, 9:12 AM

Update manual and release notes

thomasw updated this revision to Diff 3637.Jul 22 2015, 9:16 AM

Make test output more deterministic

bgamari requested changes to this revision.Jul 27 2015, 7:14 AM

@thomasw, I believe this is still missing a note pointing to the ticket and explaining how wild-cards are implemented

This revision now requires changes to proceed.Jul 27 2015, 7:14 AM

Thomas it'd be great to finish this off. nearly there!

Simon

thomasw updated this revision to Diff 3698.Jul 29 2015, 4:36 AM

Add Note [Wild cards in family instances]

@thomasw, I believe this is still missing a note pointing to the ticket and explaining how wild-cards are implemented

I added a note with the explanation and a reference to the tickets. Are there other things missing?

simonpj accepted this revision.Aug 3 2015, 7:44 AM

Looks great -- let's land it. THanks!

bgamari accepted this revision.Aug 3 2015, 7:54 AM

Thanks again!

This revision is now accepted and ready to land.Aug 3 2015, 7:54 AM
This revision was automatically updated to reflect the committed changes.