[m-dev.] for review: add support for existential types [4/4]

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jul 8 06:29:35 AEST 1998


On 04-Jul-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> You need a closing "]".

Fixed, thanks.

> On 30-Jun-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > +		%
> > +		% add the constraints for this functor
> > +		% to the current constraint set
> > +		% For functors which are data constructors,
> > +		% the fact that we don't take the dual
> > +		% corresponds to assuming that they
> > +		% will be used as constructors rather than as
> > +		% deconstructors.
> > +		%
> > +		add_constraints(OldConstraints, ConstraintsToAdd,
> >  			ClassConstraints),
> >  		type_assign_set_typeclass_constraints(TypeAssign1,
> > -			ClassConstraints, TypeAssign),
> > +			ClassConstraints, TypeAssign2),
> > +		type_assign_get_head_type_params(TypeAssign2,
> > +			HeadTypeParams0),
> > +		list__append(ConsExistQVars, HeadTypeParams0,
> > +			HeadTypeParams),
> > +		type_assign_set_head_type_params(TypeAssign2,
> > +			HeadTypeParams, TypeAssign),
> 
> If you are assuming that it is being used as a constructor and not a
> deconstructor, why do you add the ConsExistQVars to the HeadTypeParams?

The comment was backwards -- I have changed it to

		...
		% will be used as constructors rather than as
		% deconstructors.

> > @@ -3270,8 +3619,13 @@
> >  	--->	type_assign(
> >  			map(var, type),		% var types
> >  			tvarset,		% type names
> > +			headtypes,		% universally quantified
> > +						% type variables
> >  			tsubst,			% type bindings
> > -			list(class_constraint),	% typeclass constraints
> > +			class_constraints,	% typeclass constraints:
> > +						% both universal (assumed)
> > +						% and existential (the ones
> > +						% we need to prove)
> 
> I think that comment could be clearer.
> Maybe:
> 						% typeclass constraints that 
> 						% we need to prove. (either 
> 						% universal constraints from
> 						% callees or existential
> 						% constraints from the 
> 						% caller).

I changed it to the following:

			class_constraints,	% typeclass constraints.
                                % This field has the form
                                % `constraints(Universal, Existential)',
                                % The first element in this pair
                                % (the "universal" constraints) holds
                                % the constraints that we must prove,
                                % i.e. universal constraints from callees,
                                % or existential constraints on the declaration
                                % of the predicate we are analyzing.
                                % The second element in the pair 
                                % (the "existential" constraints) holds
                                % the constraints we can assume,
                                % i.e. existential constraints from callees,
                                % or universal constraints on the declaration
                                % of the predicate we are analyzing.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list