aboutsummaryrefslogtreecommitdiffstats
path: root/ecc.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ecc.hs')
-rw-r--r--ecc.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/ecc.hs b/ecc.hs
index 390bbb3..282817f 100644
--- a/ecc.hs
+++ b/ecc.hs
@@ -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