[m-dev.] user-defined equality on equivalence types

David Overton dmo at ender.cs.mu.oz.au
Thu Mar 2 14:36:30 AEDT 2000


On Thu, Mar 02, 2000 at 02:08:06PM +1100, Zoltan Somogyi wrote:
> At the moment, we allow user-defined equality only on discriminated union
> types, but not on equivalence types. This is a pain in defining ADTs such
> as sets as unsorted lists, since it requires you to wrap a functor around
> the list, even though there is no runtime efficiency penalty for using a
> notag type versus an equivalence type.
> 
> The reason for that restriction was that equivalence types were unfolded
> early. After Rob's proposed change, that reason will no longer apply, and
> I think we should then lift that restriction. The rtti changes required
> will be fairly trivial.
> 
> Comments?
> 

What equality predicate would be used for something such as:

	:- type my_int == int where equality is my_equality.

	:- pred p(int::in, my_int::in) is semidet.

	p(X, X).

(which I presume is still well-typed)?


David
-- 
David Overton       Department of Computer Science & Software Engineering
PhD Student         The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159     http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list