[m-rev.] for review: bug fix in existential constraints

Mark Brown mark at cs.mu.OZ.AU
Fri Apr 15 07:43:49 AEST 2005


On 14-Apr-2005, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> 
> On 14 Apr 2005, at 18:09, Mark Brown wrote:
> 
> >Estimated hours taken: 2
> >Branches: main, release-0.12
> >
> >Only allow existential constraints to constrain existentially 
> >quantified
> >type variables.  Likewise only allow universal constraints to constrain
> >universally quantified type variables.
> >
> >We previously didn't check these conditions, and in fact the reference
> >manual allowed otherwise.  However, the implementation did not support
> >existential constraints on universally quantified type variables, and
> >will not do so for the foreseeable future.  The implementation does 
> >support
> >universal constraints on existentially quantified variables, however 
> >these
> >are not useful since no caller will ever be able to satisfy the 
> >constraints.
> >
> 
> Out of curiosity, what does it mean for a universally quantified type 
> variable to be existentially constrained?

It means that there is some existential constraint on a pred/func declaration
(introduced with '=>' rather than '<='), and in the arguments of this
constraint there is a type variable for which there is no 'some' quantifier
out the front (the default quantifier is 'all').

The semantics of this would be that the caller has to supply a type_info
for that variable, and the callee has to return some typeclass_info which
is valid for whatever type happens to be represented by the input.  There
may be other typeclass_infos passed in by the caller (that is, there may
be universal constraints) which help the callee do this.  (And soon, there
may also be functional dependencies which could further help the callee.)

Cheers,
Mark.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list