[m-rev.] diff: fundeps, polymorphic instances

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Oct 30 10:55:12 AEDT 2006


On Sun, 29 Oct 2006, Mark Brown wrote:

> Estimated hours taken: 16
> Branches: main
>
> Support polymorphic instances of typeclasses with functional dependencies.
> We do this by allowing type variables in the range arguments, which must be
> distinct according to existing typeclass restrictions, to be determined
> from type variables in the domain arguments by the functional dependencies
> on the instance constraints.
>
> compiler/check_typeclass.m:
> 	Remove the range-restrictedness check and replace it with a coverage
> 	check, which makes use of the instance constraints when determining
> 	if a type variable is bound.
>
> 	Explicitly pass the range tvars to get_unbound_tvars, so that it
> 	can be used by the coverage pass as well as the
> 	check_typeclass_constraints pass.
>
> 	Rearrange the structure of the module, since multiple passes now
> 	make use of the get_unbound_tvars predicate.  Separate out the
> 	error reporting code from the main logic.
>
> 	Clarify the description at the top of this module.  It now corresponds
> 	more closely with the structure of the module.
>
> 	Fix a bug in check_instance_pred_procs/12 whereby the wrong context
> 	was being used in the new instance definition, leading to incorrect
> 	error messages; use field update syntax to avoid this problem.
>
> doc/reference_manual.texi:
> 	Add an example to illustrate the relaxed restrictions.
>
> tests/valid/Mmakefile:
> tests/valid/fundeps_poly_instance.m:
> 	Test the new feature.
>
> tests/invalid/Mmakefile:
> tests/invalid/fundeps_coverage.err_exp:
> tests/invalid/fundeps_coverage.m:
> 	Test the new error reporting.
>
> tests/invalid/range_restrict.err_exp:
> 	Update for the changed error message.
>
> tests/invalid/typeclass_bogus_method.err_exp:
> tests/invalid/typeclass_test_10.err_exp:
> 	Update these expected outputs for the bugfix.
>

That looks fine; it's probably worth a brief mention in the
NEWS file.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list