Support wild cards in data/type family instances
authorThomas Winant <thomas.winant@cs.kuleuven.be>
Mon, 3 Aug 2015 12:57:40 +0000 (14:57 +0200)
committerBen Gamari <ben@smart-cactus.org>
Mon, 3 Aug 2015 12:58:21 +0000 (14:58 +0200)
commitd9d2102ea7f6da1bc3a69fa469b89ea843cb8b02
tree82b0177bdb0f2696015b225177ba54eac322fd16
parent697079f118197931e7a8c0768e99bf60be4150fd
Support wild cards in data/type family instances

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

Reviewers: goldfire, austin, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: goldfire, thomie

Differential Revision: https://phabricator.haskell.org/D1092

GHC Trac Issues: #3699, #10586
16 files changed:
compiler/rename/RnSource.hs
compiler/typecheck/TcTyClsDecls.hs
docs/users_guide/7.12.1-notes.xml
docs/users_guide/glasgow_exts.xml
testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.hs [new file with mode: 0644]
testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr [new file with mode: 0644]
testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.hs [new file with mode: 0644]
testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr [new file with mode: 0644]
testsuite/tests/partial-sigs/should_compile/all.T
testsuite/tests/partial-sigs/should_fail/NamedWildcardInDataFamilyInstanceLHS.hs [new file with mode: 0644]
testsuite/tests/partial-sigs/should_fail/NamedWildcardInDataFamilyInstanceLHS.stderr [new file with mode: 0644]
testsuite/tests/partial-sigs/should_fail/NamedWildcardInTypeFamilyInstanceLHS.hs [new file with mode: 0644]
testsuite/tests/partial-sigs/should_fail/NamedWildcardInTypeFamilyInstanceLHS.stderr [new file with mode: 0644]
testsuite/tests/partial-sigs/should_fail/WildcardInTypeFamilyInstanceLHS.hs [deleted file]
testsuite/tests/partial-sigs/should_fail/WildcardInTypeFamilyInstanceLHS.stderr [deleted file]
testsuite/tests/partial-sigs/should_fail/all.T