[m-dev.] diff: typeclasses (final) [3/6]

Fergus Henderson fjh at cs.mu.oz.au
Fri Dec 19 14:29:33 AEDT 1997


On 19-Dec-1997, David Glen JEFFERY <dgj at cs.mu.oz.au> wrote:
> 
> +module_add_instance_defn(Module0, Constraints, Name, Types, Interface, VarSet,
> +		Status, _Context, Module) -->
> +	{ module_info_classes(Module0, Classes) },
> +	{ module_info_instances(Module0, Instances0) },
> +	{ list__length(Types, ClassArity) },
> +	{ Key = class_id(Name, ClassArity) },
> +	(
> +		{ map__search(Classes, Key, _) }
> +	->
> +		{ map__init(Empty) },
> +		{ NewValue = hlds_instance_defn(Status, Constraints, Types,
> +			Interface, no, VarSet, Empty) },
> +		{ map__lookup(Instances0, Key, Values) },
> +		{ map__det_update(Instances0, Key, [NewValue|Values], 
> +			Instances) },
> +		{ module_info_set_instances(Module0, Instances, Module) }
> +	;
> +			% XXX give an error since the class has not been
> +			% XXX defined
> +		{ Module = Module0 }
> +	).

That XXX really ought to be fixed.

-- 
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