fixed

Pure Haskell large fixed-width integers.
git clone git://git.ppad.tech/fixed.git
Log | Files | Refs | README | LICENSE

commit e1ff7496e985da26c4b3670290f97273422e2038
parent 7972c600d5570b586cd1bf95d19ca0060f3ccf33
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat, 22 Nov 2025 09:25:35 +0400

lib: num instances for montgomery

Diffstat:
Mlib/Numeric/Montgomery/Secp256k1/Curve.hs | 9+++++++++
Mlib/Numeric/Montgomery/Secp256k1/Scalar.hs | 9+++++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/lib/Numeric/Montgomery/Secp256k1/Curve.hs b/lib/Numeric/Montgomery/Secp256k1/Curve.hs @@ -33,6 +33,15 @@ instance Eq Montgomery where instance NFData Montgomery where rnf (Montgomery a) = case a of (# _, _, _, _ #) -> () +instance Num Montgomery where + a + b = add a b + a - b = sub a b + a * b = mul a b + negate a = neg a + abs = id + signum = id + fromInteger = to . WW.to + -- XX define constants here, current approach is fragile -- utilities ------------------------------------------------------------------ diff --git a/lib/Numeric/Montgomery/Secp256k1/Scalar.hs b/lib/Numeric/Montgomery/Secp256k1/Scalar.hs @@ -33,6 +33,15 @@ instance Eq Montgomery where instance NFData Montgomery where rnf (Montgomery a) = case a of (# _, _, _, _ #) -> () +instance Num Montgomery where + a + b = add a b + a - b = sub a b + a * b = mul a b + negate a = neg a + abs = id + signum = id + fromInteger = to . WW.to + -- XX define constants here, current approach is fragile -- utilities ------------------------------------------------------------------