diff options
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 |
commit | b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75 (patch) | |
tree | 985f21ec6924943ec2b3545f944be2037d66cb4c | |
parent | e0a6623405c50525e79717ed81ed0e75e5325fc8 (diff) | |
download | programmingbitcoin-b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75.tar.gz programmingbitcoin-b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75.tar.bz2 programmingbitcoin-b57b1b1afa7f359af5223e74a1e0c8a2b21c8b75.zip |
string interpolation for show
-rw-r--r-- | ecc.hs | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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 |