[m-dev.] for review: add support for existential types [4/4]
David Glen JEFFERY
dgj at cs.mu.OZ.AU
Sat Jul 4 19:07:43 AEST 1998
On 30-Jun-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> [continued from part 3]
>
> %
> % check that the types of the candidate predicate/function
> % subsume the actual argument types
> + % [This is the right thing to do even for calls to
> + % existentially typed preds, because we're using the
> + % type variables from the callee's pred decl (obtained
> + % from the pred_info via pred_info_arg_types) not the types
> + % inferred from the callee's clauses (and stored in the
> + % clauses_info and proc_info) -- the latter
> + % might not subsume the actual argument types.
You need a closing "]".
> + %
> + % 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?
> @@ -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).
Well... that's the final part of the diff. Phew!
I'll have a look at your replies to my comments RSN.
love and cuddles,
dgj
--
David Jeffery (dgj at cs.mu.oz.au) | Marge: Did you just call everyone "chicken"?
PhD student, | Homer: Noooo. I swear on this Bible!
Department of Computer Science | Marge: That's not a Bible; that's a book of
University of Melbourne | carpet samples!
Australia | Homer: Ooooh... Fuzzy.
More information about the developers
mailing list