modular 0.1.0.3 → 0.1.0.4
raw patch · 2 files changed
+12/−4 lines, 2 filesdep ~base
Dependency ranges changed: base
Files
- modular.cabal +2/−2
- src/Numeric/Modular.hs +10/−2
modular.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: ba1b22fbd6683c8e32ca7b66fc2cdf621d057d8cc59ac1d72ba2b83212517b38+-- hash: 3cca0e35c3a004d9e6fd76d6431d688c33815edb87da3be2b361b2cff8b451c4 name: modular-version: 0.1.0.3+version: 0.1.0.4 synopsis: Type-safe modular arithmetic description: Please the documentation on GitHub at <https://github.com/pgujjula/modular> category: Math
src/Numeric/Modular.hs view
@@ -51,8 +51,16 @@ ) where import Data.Proxy (Proxy(..))-import GHC.TypeLits (Nat, KnownNat, type (*), type (+), natVal)+import GHC.TypeLits+ ( Nat+ , KnownNat+ , type (+)+ , natVal+ ) +-- GHC weirdness won't let us import 'type (*)'+import qualified GHC.TypeLits as L+ {-| Data type to represent an integer modulo `n`. -}@@ -95,7 +103,7 @@ reifyInteger :: Integer -> (forall n. (KnownNat n) => Proxy n -> w) -> w reifyInteger 0 f = f (Proxy :: Proxy 0) reifyInteger n f- | even n = reifyInteger (n `div` 2) (\(Proxy :: Proxy n) -> f (Proxy :: Proxy (n * 2)))+ | even n = reifyInteger (n `div` 2) (\(Proxy :: Proxy n) -> f (Proxy :: Proxy (n L.* 2))) | otherwise = reifyInteger (n - 1) (\(Proxy :: Proxy n) -> f (Proxy :: Proxy (n + 1))) instance Eq (Mod m) where