diff options
-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 |