[commit: ghc] master: Implement `Natural` number type (re #9818) (8a8cdbb)

git at git.haskell.org git at git.haskell.org
Sat Nov 22 00:09:52 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8a8cdbbfd855015049526c7945cbe9ccbb152f1e/ghc

>---------------------------------------------------------------

commit 8a8cdbbfd855015049526c7945cbe9ccbb152f1e
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Nov 22 00:15:42 2014 +0100

    Implement `Natural` number type (re #9818)
    
    This implements a `Natural` type for representing unsigned arbitrary
    precision integers.
    
    When available, `integer-gmp>=1.0.0`'s `BigNat` type is used as
    building-block to construct `Natural` as an algebraic data-type.
    Otherwise, `Natural` falls back being a `newtype`-wrapper around
    `Integer` (as is done in Edward Kmett's `nats` package).
    
    The `GHC.Natural` module exposes an internal GHC-specific API, while
    `Numeric.Natural` provides the official & portable API.
    
    Reviewed By: austin, ekmett
    
    Differential Revision: https://phabricator.haskell.org/D473


>---------------------------------------------------------------

8a8cdbbfd855015049526c7945cbe9ccbb152f1e
 libraries/base/GHC/Natural.hs                      | 542 +++++++++++++++++++++
 libraries/base/Numeric/Natural.hs                  |  24 +
 libraries/base/Text/Printf.hs                      |   5 +
 libraries/base/base.cabal                          |   2 +
 libraries/base/changelog.md                        |   4 +
 .../integer-gmp2/src/GHC/Integer/GMP/Internals.hs  |   1 +
 libraries/integer-gmp2/src/GHC/Integer/Type.hs     |   1 +
 7 files changed, 579 insertions(+)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8a8cdbbfd855015049526c7945cbe9ccbb152f1e


More information about the ghc-commits mailing list