aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2021-05-02 11:40:32 +0200
committerÓscar Nájera <hi@oscarnajera.com>2021-05-02 11:40:32 +0200
commitb57b1b1afa7f359af5223e74a1e0c8a2b21c8b75 (patch)
tree985f21ec6924943ec2b3545f944be2037d66cb4c
parente0a6623405c50525e79717ed81ed0e75e5325fc8 (diff)
downloadprogrammingbitcoin-b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75.tar.gz
programmingbitcoin-b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75.tar.bz2
programmingbitcoin-b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75.zip
string interpolation for show
-rw-r--r--ecc.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/ecc.hs b/ecc.hs
index 7c485d0..a35fb24 100644
--- a/ecc.hs
+++ b/ecc.hs
@@ -1,3 +1,4 @@
+import Text.Printf
data FieldElement =
FieldElement
@@ -56,9 +57,7 @@ data ECPoint
instance Show ECPoint where
show Infinity = "ECPoint(Infinity)"
- show p =
- "ECPoint(" ++
- show (x p) ++ ", " ++ show (y p) ++ ")_" ++ show (a p) ++ "_" ++ show (b p)
+ show p = printf "ECPoint(%f, %f)_%f_%f" (x p) (y p) (a p) (b p)
validECPoint :: ECPoint -> Bool
validECPoint Infinity = True