[m-users.] Typeclasses

Dirk Ziegemeyer dirk at ziegemeyer.de
Mon Oct 16 01:52:17 AEDT 2017


> Am 15.10.2017 um 15:38 schrieb Mark Brown <mark at mercurylang.org>:
> 
> On Sun, Oct 15, 2017 at 8:24 PM, Tomas By <tomas at basun.net> wrote:
>> On 2017-10-15 00:25, Mark Brown wrote:
>>> 
>>> How did you know the keys and values were ints?
>> 
>> I just wanted to get something to compile with the minimum hassle.
>> 
> 
> Thanks. I thought maybe I'd missed an email from the list, since
> somebody else recently reported a similar problem. In the OP the
> instance ranged over all key and value types, not just ints.

I tried to compile different variants and posted one of this. Thomas’ solution was accidentally similar to my first try.

Is it worth to mention in the reference manual, that Mercury's requirement that a type in an instance declaration must be either a type with no arguments or a polymorphic type whose arguments are all type variables stems from a restriction in Mercury’s typeclass implementation? - And that this restriction can be bypassed with a wrapper type?

Dirk.


More information about the users mailing list