Safe Haskell | None |
---|---|
Language | Haskell2010 |
Modular arithmetic
MInt is a newtype of Int for arithmetic modulo a known fixed prime. For a more general type see Mod.hs.
Instances of Eq, Num, Fractional exist for MInt. All the usual operations take O(1) time, except for recip which takes O(log m) time. An instance of Enum exists for MInt. The enum is cyclic, it wraps to 0 after m-1. Unboxed array support is available via Unbox.