[m-rev.] for review: use typeclass constraints to help resolve overloading
Peter Ross
peter.ross at miscrit.be
Wed Jan 16 17:16:28 AEDT 2002
On Wed, Jan 16, 2002 at 03:15:36PM +1100, Peter Ross wrote:
> +:- pred instance_decl_exists(module_info::in, (type)::in,
> + {int, class_constraint}::in) is semidet.
> +
> +instance_decl_exists(ModuleInfo, ArgType, {N, constraint(Name, Types)}) :-
> + module_info_instances(ModuleInfo, Instances),
> + map__lookup(Instances, class_id(Name, list__length(Types)),
> + InstanceDefns),
> + list__filter((pred(InstanceDefn::in) is semidet :-
> + InstanceDefn = hlds_instance_defn(_, _, _, _,
> + InstanceTypes, _, _, _, _),
> + list__index1_det(InstanceTypes, N, InstanceType),
> + type_list_subsumes([ArgType], [InstanceType], _)
> + ), InstanceDefns, Compatible, _Incompatible),
> +
> + % There must be at least one instance declaration which
> + % metions the ArgType.
> + Compatible = [_ | _].
The arguments of type_list_subsumes are the wrong way around.
--------------------------------------------------------------------------
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