type-level-natural-number: Simple type level natural numbers
This is a simple implementation of type-level natural numbers that only requires DeriveDataTypeable. Operations requiring more language extensions have been split into a separate package.
The difference between this package and the many others on Hackage implementing type-level naturals is its emphasis on simplicity. It only supports non-negative natural numbers, and only the successor and predicessor operations. It represents natural numbers using a type-level linked list, so it is not intended to be used for representing large numbers. Pre-defined aliases for natural numbers up to 15 are provided.
The code for this package was largely taken from the excellent Vec package; I created this package with the intent of making this functionality more widely available.
Difference from 1.0: Added instances for Typeable, and word synonyms for N0...N15.
Difference from 1.1: Performance enhancements for naturalNumberAsInt. Simplified Show implementation.
Difference from 1.1.1: Gave up on Haskell 2010 compatibility since as of GHC 7.8 manually deriving from Typeable is no longer allowed; now I use DeriveDataTypeable to construct the instances.
Downloads
- type-level-natural-number-2.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 1.0, 1.1, 1.1.1, 2.0 |
---|---|
Dependencies | base (>=3 && <5) [details] |
License | BSD-3-Clause |
Author | Gregory Crosswhite |
Maintainer | Gregory Crosswhite <gcrosswhite@gmail.com> |
Category | Type System, Data |
Source repo | head: git clone git://github.com/gcross/type-level-natural-number.git this: git clone git://github.com/gcross/type-level-natural-number.git(tag 1.1.1) |
Uploaded | by GregoryCrosswhite at 2014-03-30T18:38:47Z |
Distributions | LTSHaskell:2.0, NixOS:2.0, Stackage:2.0 |
Reverse Dependencies | 8 direct, 7 indirect [details] |
Downloads | 3746 total (24 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Successful builds reported [all 1 reports] |