| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea was promted by Trac #9939, but it was Christmas, so I did
some recreational programming that went much further.
The idea is to warn when a constraint in a user-supplied context is
redundant. Everything is described in detail in
Note [Tracking redundant constraints]
in TcSimplify.
Main changes:
* The new ic_status field in an implication, of type ImplicStatus.
It replaces ic_insol, and includes information about redundant
constraints.
* New function TcSimplify.setImplicationStatus sets the ic_status.
* TcSigInfo has sig_report_redundant field to say whenther a
redundant constraint should be reported; and similarly
the FunSigCtxt constructor of UserTypeCtxt
* EvBinds has a field eb_is_given, to record whether it is a given
or wanted binding. Some consequential chagnes to creating an evidence
binding (so that we record whether it is given or wanted).
* AbsBinds field abs_ev_binds is now a *list* of TcEvBiinds;
see Note [Typechecking plan for instance declarations] in
TcInstDcls
* Some significant changes to the type checking of instance
declarations; Note [Typechecking plan for instance declarations]
in TcInstDcls.
* I found that TcErrors.relevantBindings was failing to zonk the
origin of the constraint it was looking at, and hence failing to
find some relevant bindings. Easy to fix, and orthogonal to
everything else, but hard to disentangle.
Some minor refactorig:
* TcMType.newSimpleWanteds moves to Inst, renamed as newWanteds
* TcClassDcl and TcInstDcls now have their own code for typechecking
a method body, rather than sharing a single function. The shared
function (ws TcClassDcl.tcInstanceMethodBody) didn't have much code
and the differences were growing confusing.
* Add new function TcRnMonad.pushLevelAndCaptureConstraints, and
use it
* Add new function Bag.catBagMaybes, and use it in TcSimplify
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The purpose of silent superclass parameters was to solve the
awkward problem of superclass dictinaries being bound to bottom.
See THE PROBLEM in Note [Recursive superclasses] in TcInstDcls
Although the silent-superclass idea worked,
* It had non-local consequences, and had effects even in Haddock,
where we had to discard silent parameters before displaying
instance declarations
* It had unexpected peformance costs, shown up by Trac #3064 and its
test case. In monad-transformer code, when constructing a Monad
dictionary you had to pass an Applicative dictionary; and to
construct that you neede a Functor dictionary. Yet these extra
dictionaries were often never used. (All this got much worse when
we added Applicative as a superclass of Monad.) Test T3064
compiled *far* faster after silent superclasses were eliminated.
* It introduced new bugs. For example SilentParametersOverlapping,
T5051, and T7862, all failed to compile because of instance overlap
directly because of the silent-superclass trick.
So this patch takes a new approach, which I worked out with Dimitrios
in the closing hours before Christmas. It is described in detail
in THE PROBLEM in Note [Recursive superclasses] in TcInstDcls.
Seems to work great!
Quite a bit of knock-on effect
* The main implementation work is in tcSuperClasses in TcInstDcls
Everything else is fall-out
* IdInfo.DFunId no longer needs its n-silent argument
* Ditto IDFunId in IfaceSyn
* Hence interface file format changes
* Now that DFunIds do not have silent superclass parameters, printing
out instance declarations is simpler. There is tiny knock-on effect
in Haddock, so that submodule is updated
* I realised that when computing the "size of a dictionary type"
in TcValidity.sizePred, we should be rather conservative about
type functions, which can arbitrarily increase the size of a type.
Hence the new datatype TypeSize, which has a TSBig constructor for
"arbitrarily big".
* instDFunType moves from TcSMonad to Inst
* Interestingly, CmmNode and CmmExpr both now need a non-silent
(Ord r) in a couple of instance declarations. These were previously
silent but must now be explicit.
* Quite a bit of wibbling in error messages
|
|
|
|
|
|
|
| |
This matches GCC's choice of Unicode quotation marks (i.e. U+2018 and U+2019)
and therefore looks more familiar on the console. This addresses #2507.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
| |
|
|
|
|
|
|
| |
Notably
* Showing relevant bindings
* Not suggesting add instance (Num T); see Trac #7222
|
|
|
|
| |
...in response to Trac #5858
|
|
|