modular-arithmetic 1.0.0.1 → 1.0.1.0
raw patch · 2 files changed
+7/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Modular: toMod' :: (Integral i, Integral j, SingI n) => i -> j Mod n
Files
- modular-arithmetic.cabal +1/−1
- src/Data/Modular.hs +6/−1
modular-arithmetic.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: modular-arithmetic-version: 1.0.0.1+version: 1.0.1.0 synopsis: A type for integers modulo some constant. description: This module provides a convenient type for working with
src/Data/Modular.hs view
@@ -43,7 +43,7 @@ -- 2 -- @ -module Data.Modular (unMod, toMod, Mod, (/)(), ℤ) where+module Data.Modular (unMod, toMod, toMod', Mod, (/)(), ℤ) where import Control.Arrow (first) @@ -75,6 +75,11 @@ -- appropriate. toMod :: forall n i. (Integral i, SingI n) => i -> i `Mod` n toMod i = Mod $ i `mod` unMod (_bound :: i `Mod` n)++-- | Wraps an integral number to a mod, converting between integral+-- types.+toMod' :: forall n i j. (Integral i, Integral j, SingI n) => i -> j `Mod` n+toMod' = toMod . fromIntegral instance Show i => Show (i `Mod` n) where show (Mod i) = show i instance (Read i, Integral i, SingI n) => Read (i `Mod` n)