Entirely re-jig the handling of default type-family instances (fixes Trac #9063)
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 15 Jul 2014 06:43:55 +0000 (07:43 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 15 Jul 2014 06:43:55 +0000 (07:43 +0100)
commit9b8ba62991ae22420a0c4486127a3b22ee7f22bd
tree69e03640c54a4393efe91a5f184b764692460808
parentf692e8e7cde712cc4dce4245d5745063fd8b0626
Entirely re-jig the handling of default type-family instances (fixes Trac #9063)

In looking at Trac #9063 I decided to re-design the default
instances for associated type synonyms.  Previously it was all
jolly complicated, to support generality that no one wanted, and
was arguably undesirable.

Specifically

* The default instance for an associated type can have only
  type variables on the LHS.  (Not type patterns.)

* There can be at most one default instances declaration for
  each associated type.

To achieve this I had to do a surprisingly large amount of refactoring
of HsSyn, specifically to parameterise HsDecls.TyFamEqn over the type
of the LHS patterns.

That change in HsDecls has a (trivial) knock-on effect in Haddock, so
this commit does a submodule update too.

The net result is good though.  The code is simpler; the language
specification is simpler.  Happy days.

Trac #9263 and #9264 are thereby fixed as well.
38 files changed:
compiler/deSugar/DsMeta.hs
compiler/hsSyn/Convert.lhs
compiler/hsSyn/HsDecls.lhs
compiler/iface/IfaceSyn.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/parser/RdrHsSyn.lhs
compiler/rename/RnSource.lhs
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcInstDcls.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/typecheck/TcValidity.lhs
compiler/types/Class.lhs
docs/users_guide/glasgow_exts.xml
testsuite/tests/indexed-types/should_fail/Overlap4.stderr
testsuite/tests/indexed-types/should_fail/Overlap5.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail1a.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail1b.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr
testsuite/tests/parser/should_fail/T8506.stderr
testsuite/tests/parser/should_fail/readFail025.stderr
testsuite/tests/polykinds/Makefile
testsuite/tests/polykinds/T7939a.stderr
testsuite/tests/polykinds/T9063.hs [new file with mode: 0644]
testsuite/tests/polykinds/T9263.hs [new file with mode: 0644]
testsuite/tests/polykinds/T9263a.hs [new file with mode: 0644]
testsuite/tests/polykinds/T9263b.hs [new file with mode: 0644]
testsuite/tests/polykinds/T9264.hs [new file with mode: 0644]
testsuite/tests/polykinds/all.T
testsuite/tests/typecheck/should_compile/T5481.stderr
testsuite/tests/typecheck/should_compile/tc253.hs
testsuite/tests/typecheck/should_fail/AssocTyDef02.stderr
testsuite/tests/typecheck/should_fail/AssocTyDef03.stderr
testsuite/tests/typecheck/should_fail/AssocTyDef04.stderr
testsuite/tests/typecheck/should_fail/AssocTyDef05.stderr
testsuite/tests/typecheck/should_fail/AssocTyDef06.stderr
utils/haddock