A useful type for working with integers modulo some constant.
Haskell
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/Data Add CPP extension into Modular.hs, cabal doesn't pick up the CPP exte… Apr 19, 2018
test-suite Stylished test file. May 1, 2015
.gitignore
.travis.yml Travis CI config Apr 30, 2015
CHANGELOG.md
LICENSE
README.md update README after the haddock documentation Apr 30, 2015
Setup.hs Set up the basic files. May 18, 2013
modular-arithmetic.cabal

README.md

Modular Arithmetic

Hackage package Build Status

This package provides a type for integers modulo some constant, usually written as ℤ/n.

Here is a quick example:

>>> 10 * 11 :: ℤ/7
5

It also works correctly with negative numeric literals:

>>> (-10) * 11 :: ℤ/7
2

Modular division is an inverse of modular multiplication. It is defined when divisor is coprime to modulus:

>>> 7 `div` 3 :: ℤ/16
13
>>> 3 * 13 :: ℤ/16
7