[mercury-users] type-equivalence for DUs

doug.auclair at logicaltypes.com doug.auclair at logicaltypes.com
Thu Mar 16 14:52:26 AEDT 2006

Dear Ralph, thanks for your reply.  The solution was:

>coffee_goodness(A, B) :-
>        promise_equivalent_solutions [Same] same_num_shots(A, B, Same),
>        Same = yes.
>:- pred same_num_shots(espresso::in, espresso::in, bool::out) is cc_multi.
>same_num_shots(single(_), single(_), yes).
>same_num_shots(single(_), duo(_, _), no).
>same_num_shots(duo(_, _), single(_), no).
>same_num_shots(duo(_, _), duo(_, _), yes).

Given that solution, I'm very glad you wrote, because, even after reading
the relevant sections (and understanding them poorly, it seems), I would
have never arrived at this after 100 million years (<- that's a long time).

>The reason why you have to do this in two steps is that types with
>user defined equality are non-canonical.

Yes, read that.  I'm glad that the Mercury team is working on an alternate
to the above (clear and concise, I hope?).

Doug Auclair

mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list