diff options
-rw-r--r-- | ecc.hs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |