From 8a8cdbbfd855015049526c7945cbe9ccbb152f1e Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sat, 22 Nov 2014 00:15:42 +0100 Subject: 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 --- libraries/base/Numeric/Natural.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 libraries/base/Numeric/Natural.hs (limited to 'libraries/base/Numeric/Natural.hs') 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 -- cgit v1.2.1