<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">having read 4.2.2 Equivalence types, I see that it is possible to create an equivalence type using type abbreviations but I can't figure out how to get one to work for a parameterised type class using sets.<div><br></div><div><b>:- type l1_set(T) == set(hittable(T)).</b></div><div><br></div><div>gives error:</div><div><div><span class="Apple-tab-span" style="white-space:pre"> </span>level_ufo.m:804: In definition of type `l1_set'/1:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>level_ufo.m:804: error: undefined type `hittable'/1.</div></div><div><br></div><div>which is clear; hittable is indeed not a type, it's a typeclass, this was a deliberate 'process of elimination' for my thought process!</div><div><br></div><div>Then I did what I thought would work:</div><div><br></div><div><div><b>:- type l1_set(T) == set(hittable(T)) <= hittable(T).</b></div></div><div><br></div><div><div>but this gives the error:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>level_ufo.m:804: On the left hand side of type definition: error: type</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>level_ufo.m:804: parameters must be variables, but</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>level_ufo.m:804: `(l1_set(T) == set(hittable(T)))' and `hittable(T)' are not.</div></div><div><br></div><div>And here is the actual code where I am trying to use it, I am operating on the assumption that by default Mercury has some way of creating a unique hash for each object in the set to know what insert_new should do the right thing. I read "4.5. The Standard ordering" but I can't remember where I am sure I've seen about overriding this behaviour, it mentioned Haskell I think. Ah.. it is section 3.8 of the online page <a href="https://mercury-in.space/crash.html#orga13c54a">https://mercury-in.space/crash.html#orga13c54a</a></div><div><br></div><div>What am I not doing correctly? Is it possible?</div><div><br></div><div>Thanks,</div><div>Sean.</div><div><br></div></body></html>