shithub: MicroHs

Download patch

ref: e00bf634e4948d2870d801e58a7272800d115630
parent: 7a9a4c585a271b81983b14fc3ea9d6a8d7712252
author: Lennart Augustsson <lennart@augustsson.net>
date: Thu Sep 26 14:55:52 EDT 2024

Reenable instances

--- a/lib/Data/Fixed.hs
+++ b/lib/Data/Fixed.hs
@@ -105,7 +105,6 @@
 
 instance (HasResolution a) => Num (Fixed a) where
     (MkFixed a) + (MkFixed b) = MkFixed (a + b)
-{-
     (MkFixed a) - (MkFixed b) = MkFixed (a - b)
     fa@(MkFixed a) * (MkFixed b) = MkFixed (div (a * b) (resolution fa))
     negate (MkFixed a) = MkFixed (negate a)
@@ -112,18 +111,15 @@
     abs (MkFixed a) = MkFixed (abs a)
     signum (MkFixed a) = fromInteger (signum a)
     fromInteger i = withResolution (\res -> MkFixed (i * res))
--}
 
 instance (HasResolution a) => Real (Fixed a) where
     toRational fa@(MkFixed a) = (toRational a) / (toRational (resolution fa))
 
 instance (HasResolution a) => Fractional (Fixed a) where
-{-
     fa@(MkFixed a) / (MkFixed b) = MkFixed (div (a * (resolution fa)) b)
     recip fa@(MkFixed a) = MkFixed (div (res * res) a) where
         res = resolution fa
     fromRational r = withResolution (\res -> MkFixed (floor (r * (toRational res))))
--}
 
 instance (HasResolution a) => RealFrac (Fixed a) where
     properFraction a = (i,a - (fromIntegral i)) where
@@ -161,16 +157,12 @@
     divCeil x y = (x + y - 1) `div` y
 
 instance (HasResolution a) => Show (Fixed a) where
-{-
     showsPrec p n = showParen (p > 6 && n < 0) $ showString $ showFixed False n
--}
 
 instance (HasResolution a) => Read (Fixed a) where
-{-
     readPrec     = readNumber convertFixed
     readListPrec = readListPrecDefault
     readList     = readListDefault
--}
 
 convertFixed :: forall a . HasResolution a => Lexeme -> ReadPrec (Fixed a)
 convertFixed (Number n)