From 224f0cc6d59c45abe67bbcef4d76b2dc1c99effd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Mon, 5 Apr 2021 20:50:24 +0200 Subject: organize --- ecc.hs | 10 +++++----- 1 file 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 -- cgit v1.2.3