diff options
author | Óscar Nájera <hi@oscarnajera.com> | 2021-04-05 20:50:24 +0200 |
---|---|---|
committer | Óscar Nájera <hi@oscarnajera.com> | 2021-04-05 20:50:24 +0200 |
commit | 224f0cc6d59c45abe67bbcef4d76b2dc1c99effd (patch) | |
tree | 6ef46e41506bb34918a2d76a273eff30944c9620 | |
parent | bc0120183d4d3852af87deb58f81c6c31c3d6388 (diff) | |
download | programmingbitcoin-224f0cc6d59c45abe67bbcef4d76b2dc1c99effd.tar.gz programmingbitcoin-224f0cc6d59c45abe67bbcef4d76b2dc1c99effd.tar.bz2 programmingbitcoin-224f0cc6d59c45abe67bbcef4d76b2dc1c99effd.zip |
organize
-rw-r--r-- | ecc.hs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -2,17 +2,13 @@ data FieldElement = FieldElement { number :: Int - , prime :: Int + , prime :: Int } deriving (Eq) instance Show FieldElement where show a = "FieldElement_" ++ show (prime a) ++ " " ++ show (number a) -assert :: Bool -> Bool -assert False = error "WRONG" -assert x = x - instance Num FieldElement where (FieldElement a b) + (FieldElement c d) | b /= d = error "Distinct Fields" @@ -29,6 +25,10 @@ instance Fractional FieldElement where recip a = a ^ (prime a - 2) fromRational _ = error "can't transform" +assert :: Bool -> Bool +assert False = error "WRONG" +assert x = x + aa = let a = FieldElement 2 31 b = FieldElement 15 31 |