aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecc.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/ecc.hs b/ecc.hs
index e639e3a..83a9fb1 100644
--- a/ecc.hs
+++ b/ecc.hs
@@ -57,7 +57,12 @@ data ECPoint a
}
deriving (Eq)
-instance KnownNat n => Show (ECPoint (FieldElement n)) where
+
+instance {-# OVERLAPPABLE #-} (PrintfArg a, Num a) => Show (ECPoint a) where
+ show Infinity = "ECPoint(Infinity)"
+ show p = printf "ECPoint(%f, %f)_%f_%f" (x p) (y p) (a p) (b p)
+
+instance {-# OVERLAPPING #-} KnownNat n => Show (ECPoint (FieldElement n)) where
show Infinity = "ECPoint(Infinity)"
show p
| n == (2 ^ 256 - 2 ^ 32 - 977) = "S256Point" ++ points