[m-rev.] diff: fundeps, polymorphic instances
Mark Brown
mark at csse.unimelb.edu.au
Mon Oct 30 12:04:47 AEDT 2006
On 30-Oct-2006, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 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.
>
> That looks fine; it's probably worth a brief mention in the
> NEWS file.
Estimated hours taken: 0.25
Branches: main
NEWS:
Mention the recent change to functional dependencies support.
Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.427
diff -u -r1.427 NEWS
--- NEWS 12 Oct 2006 06:30:16 -0000 1.427
+++ NEWS 30 Oct 2006 00:56:05 -0000
@@ -3,6 +3,8 @@
Changes to the Mercury language:
+* Some of the restrictions on typeclass instances have been relaxed, allowing
+ support for polymorphic instances with functional dependencies.
* We now support trace goals, which can be used to print progress messages or
log messages in the middle of arbitrary computations.
* Mutables can now be marked as constant, which is useful when working with
@@ -44,6 +46,23 @@
Changes to the Mercury language:
+* The restriction on typeclass instances that all type variables appearing in
+ the range of a functional dependency must be monomorphic has been relaxed.
+ We now support cases where the type variables in the range are determined
+ by the type variables in the domain, using the functional dependency
+ information from any instance constraints.
+
+ For example, given the typeclass
+
+ :- typeclass foo(A, B) <= (A -> B).
+
+ the following instance is now valid:
+
+ :- instance foo(list(S), list(T)) <= foo(S, T).
+
+ since the variable T, in the range, is determined from the variable S by the
+ functional dependencies on the foo(S, T) constraint.
+
* A new language construct allows programmers to include debugging and/or
logging code in the middle of arbitrary computations. Trace goals
may have both compile time and run time conditions placed on their execution.
--------------------------------------------------------------------------
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