[Haskell-beginners] Implementing instance of '^' operator

Harald Hanche-Olsen hanche at math.ntnu.no
Sun Jan 3 13:06:55 UTC 2016


-----Original Message-----
From: pmcilroy at gmail.com <pmcilroy at gmail.com>
Date: 3 January 2016 at 07:55:53

> As a ‘hello world’ example for type definitions, I like to define a numeric type that can  
> handle the mod p multiplicative group, where p is prime. This requires:
> • Implementing interface functions

[…]

I can’t help with the question you’re asking, but I have a minor nitpick: You want to have
negate (Modp p 0) = Modp p 0,
and not Modp p p as in your current implementation.

– Harald


More information about the Beginners mailing list