modular-arithmetic 1.0.1.1 → 1.1.0.0
raw patch · 2 files changed
+7/−1 lines, 2 files
Files
- modular-arithmetic.cabal +1/−1
- src/Data/Modular.hs +6/−0
modular-arithmetic.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: modular-arithmetic-version: 1.0.1.1+version: 1.1.0.0 synopsis: A type for integers modulo some constant. description: This module provides a convenient type for working with
src/Data/Modular.hs view
@@ -93,6 +93,12 @@ toEnum = fromInteger . toInteger fromEnum = fromInteger . toInteger . unMod + enumFrom x = enumFromTo x maxBound+ enumFromThen x y = enumFromThenTo x y bound+ where+ bound | fromEnum y >= fromEnum x = maxBound+ | otherwise = minBound+ instance (Integral i, SingI n) => Bounded (i `Mod` n) where maxBound = pred _bound minBound = 0