Fixed size bit vectors using GHC's new type-level naturals
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
src/Numeric
.ghci
LICENSE
README.md
Setup.hs
default.nix
deploy.sh
mod-n.cabal
update_docs.sh

README.md

mod-n

The integers under a modulus, using GHC.TypeLits. Values are not constructed directly, but are calculated by fromInteger. The fact that the Mod type's constructor is not exposed ensures the following invariant:

0 <= fromIntegral (x :: Mod n) < natVal' (proxy# :: Proxy# n)

This package is mostly just an auxilary for bigword. It just seemed like a general (and useful) enough type to exist on its own.