modular-arithmetic 1.2.1.1 → 1.2.1.2
raw patch · 3 files changed
+19/−8 lines, 3 filesdep ~basedep ~doctestPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, doctest
API changes (from Hackage documentation)
- Data.Modular: instance (Integral i, KnownNat n) => Bounded (Mod i n)
- Data.Modular: instance (Integral i, KnownNat n) => Enum (Mod i n)
- Data.Modular: instance (Integral i, KnownNat n) => Integral (Mod i n)
- Data.Modular: instance (Integral i, KnownNat n) => Num (Mod i n)
- Data.Modular: instance (Integral i, KnownNat n) => Real (Mod i n)
- Data.Modular: instance (Read i, Integral i, KnownNat n) => Read (Mod i n)
- Data.Modular: instance Eq i => Eq (Mod i n)
- Data.Modular: instance Ord i => Ord (Mod i n)
- Data.Modular: instance Show i => Show (Mod i n)
- Data.Modular: instance Show i => Show (SomeMod i)
+ Data.Modular: instance (GHC.Read.Read i, GHC.Real.Integral i, GHC.TypeLits.KnownNat n) => GHC.Read.Read (Data.Modular.Mod i n)
+ Data.Modular: instance (GHC.Real.Integral i, GHC.TypeLits.KnownNat n) => GHC.Enum.Bounded (Data.Modular.Mod i n)
+ Data.Modular: instance (GHC.Real.Integral i, GHC.TypeLits.KnownNat n) => GHC.Enum.Enum (Data.Modular.Mod i n)
+ Data.Modular: instance (GHC.Real.Integral i, GHC.TypeLits.KnownNat n) => GHC.Num.Num (Data.Modular.Mod i n)
+ Data.Modular: instance (GHC.Real.Integral i, GHC.TypeLits.KnownNat n) => GHC.Real.Integral (Data.Modular.Mod i n)
+ Data.Modular: instance (GHC.Real.Integral i, GHC.TypeLits.KnownNat n) => GHC.Real.Real (Data.Modular.Mod i n)
+ Data.Modular: instance GHC.Classes.Eq i => GHC.Classes.Eq (Data.Modular.Mod i n)
+ Data.Modular: instance GHC.Classes.Ord i => GHC.Classes.Ord (Data.Modular.Mod i n)
+ Data.Modular: instance GHC.Show.Show i => GHC.Show.Show (Data.Modular.Mod i n)
+ Data.Modular: instance GHC.Show.Show i => GHC.Show.Show (Data.Modular.SomeMod i)
- Data.Modular: inv :: (KnownNat n, Integral i) => Mod i n -> Mod i n
+ Data.Modular: inv :: forall n i. (KnownNat n, Integral i) => Mod i n -> Mod i n
- Data.Modular: modVal :: (Integral i, KnownNat n) => i -> proxy n -> Mod i n
+ Data.Modular: modVal :: forall i proxy n. (Integral i, KnownNat n) => i -> proxy n -> Mod i n
- Data.Modular: toMod :: (Integral i, KnownNat n) => i -> i `Mod` n
+ Data.Modular: toMod :: forall n i. (Integral i, KnownNat n) => i -> i `Mod` n
- Data.Modular: toMod' :: (Integral i, Integral j, KnownNat n) => i -> j `Mod` n
+ Data.Modular: toMod' :: forall n i j. (Integral i, Integral j, KnownNat n) => i -> j `Mod` n
Files
- CHANGELOG.md +9/−0
- modular-arithmetic.cabal +5/−5
- src/Data/Modular.hs +5/−3
CHANGELOG.md view
@@ -1,3 +1,12 @@+1.2.1.2+---+* exported the `/` type operator with `ExplicitNamespaces` enabled to+ support GHC 8. Should be backwards compatible through GHC 7.6.++1.2.1.1+---+* added a basic test suite with doctests+ 1.2.1.0 --- * changed `Integral` implementation: `quotRem` now uses modular inversion!
modular-arithmetic.cabal view
@@ -1,5 +1,5 @@ name: modular-arithmetic-version: 1.2.1.1+version: 1.2.1.2 synopsis: A type for integers modulo some constant. description: A convenient type for working with integers modulo some constant. It saves you from manually wrapping numeric operations all over the place and prevents a range of simple mistakes. @Integer `Mod` 7@ is the type of integers (mod 7) backed by @Integer@.@@ -26,12 +26,12 @@ hs-source-dirs: src ghc-options: -Wall exposed-modules: Data.Modular- build-depends: base >=4.7 && <5+ build-depends: base >= 4.7 && < 5 test-suite examples hs-source-dirs: test-suite main-is: DocTest.hs type: exitcode-stdio-1.0- build-depends: base- , Glob ==0.7.*- , doctest ==0.9.*+ build-depends: base >= 4.7 && < 5+ , Glob >= 0.7 && < 0.8+ , doctest >= 0.9 && < 0.12
src/Data/Modular.hs view
@@ -3,8 +3,10 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE GADTs #-}-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ExplicitNamespaces #-}+ -- | -- Types for working with integers modulo some constant. module Data.Modular (@@ -16,7 +18,7 @@ -- * Modular arithmetic Mod, unMod, toMod, toMod',- inv, (/)(), ℤ,+ inv, type (/)(), ℤ, modVal, SomeMod, someModVal ) where @@ -154,7 +156,7 @@ -- -- Note that only numbers coprime to @n@ have an inverse modulo @n@: ----- >>> inv 6 :: ℤ/15+-- > inv 6 :: ℤ/15 -- *** Exception: divide by 6 (mod 15), non-coprime to modulus -- inv :: forall n i. (KnownNat n, Integral i) => Mod i n -> Mod i n