[m-rev.] diff: common.m improvement

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 20 19:57:34 AEST 2005


On 20-Apr-2005, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> compiler/common.m:
> 	Allow the equality test for types succeed even for types that cannot
> 	be deconstructed, such as the ones for typeclassinfos.

Won't this cause the equality test to fail for types which are
equal but which contain different contexts (the term.context field)?

I think it might be better to have something like this:

	common__types_match_exactly(Type1, Type2) :-
		(
		    Type1 = Type2
		;
		    % check if the types are the same when you
		    % ignore the term.context fields

		    % XXX should succeed for embedded constraints
		    type_to_ctor_and_args(Type1, TypeCtor1, Args1),
		    type_to_ctor_and_args(Type2, TypeCtor2, Args2),
		    TypeCtor1 = TypeCtor2,
		    common__types_match_exactly_list(Args1, Args2)
		).

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