aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2021-07-06 20:50:35 +0200
committerÓscar Nájera <hi@oscarnajera.com>2021-07-06 20:50:35 +0200
commitf997c04eb1dcdcdf9b4cccccaa38f816d9c5c449 (patch)
treea15484d99099310dc8f10377db010146f8b60c49
parent226740b45a5a94811404f4fabfb09f0100ddf61f (diff)
downloadprogrammingbitcoin-f997c04eb1dcdcdf9b4cccccaa38f816d9c5c449.tar.gz
programmingbitcoin-f997c04eb1dcdcdf9b4cccccaa38f816d9c5c449.tar.bz2
programmingbitcoin-f997c04eb1dcdcdf9b4cccccaa38f816d9c5c449.zip
remove fromRational implementation as not really defined
-rw-r--r--ecc.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/ecc.hs b/ecc.hs
index 83a9fb1..17029b6 100644
--- a/ecc.hs
+++ b/ecc.hs
@@ -6,7 +6,7 @@
import Data.Bits
import Data.Proxy
-import Data.Ratio (denominator, numerator)
+--import Data.Ratio (denominator, numerator)
import GHC.TypeLits
import Text.Printf (PrintfArg, printf)
@@ -24,7 +24,7 @@ instance KnownNat n => Num (FieldElement n) where
instance KnownNat n => Fractional (FieldElement n) where
recip a = a ^ (n - 2) where n = natVal (Proxy :: Proxy n)
- fromRational r = fromInteger (numerator r) / fromInteger (denominator r)
+ fromRational r = error "cant transform" -- fromInteger (numerator r) / fromInteger (denominator r)
instance KnownNat n => Show (FieldElement n) where
show (FieldElement a) | n == (2 ^ 256 - 2 ^ 32 - 977) = printf "0x%064x" a