summaryrefslogtreecommitdiff
path: root/libraries/base/Numeric/Natural.hs
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-11-22 00:15:42 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2014-11-22 01:03:55 +0100
commit8a8cdbbfd855015049526c7945cbe9ccbb152f1e (patch)
tree700e0ef50eab611b67d4f64608fd701170b27709 /libraries/base/Numeric/Natural.hs
parent137b33133f49a994e5d147c5b30a8fcfc610eada (diff)
downloadhaskell-8a8cdbbfd855015049526c7945cbe9ccbb152f1e.tar.gz
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
Diffstat (limited to 'libraries/base/Numeric/Natural.hs')
-rw-r--r--libraries/base/Numeric/Natural.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/libraries/base/Numeric/Natural.hs b/libraries/base/Numeric/Natural.hs
new file mode 100644
index 0000000000..3a96501f1e
--- /dev/null
+++ b/libraries/base/Numeric/Natural.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE Trustworthy #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module : Numeric.Natural
+-- Copyright : (C) 2014 Herbert Valerio Riedel,
+-- (C) 2011 Edward Kmett
+-- License : see libraries/base/LICENSE
+--
+-- Maintainer : libraries@haskell.org
+-- Stability : provisional
+-- Portability : portable
+--
+-- The arbitrary-precision 'Natural' number type.
+--
+-- /Since: 4.8.0.0/
+-----------------------------------------------------------------------------
+
+module Numeric.Natural
+ ( Natural
+ ) where
+
+import GHC.Natural