...  ...  @@ 9,7 +9,7 @@ This wiki page is meant as a scratchpad to describe the plans/ideas behind the 


 avoid issues when linking against other C libraries using GMP,



 simplify code, as we would perform all heap allocations in Haskell code (and never inside Cmm/C code as its done now),



 maybe even remove a few more superfluous temporary heap allocations.



 linktime selectable integerlibrary backend (think `ghc make O fintegerlibrary=bsdnt` Hello.hs)



 linktime selectable integerlibrary backend (think `ghc make O fintegerlibrary=bsdnt Hello.hs`)






 simplifies handling on platforms where GMP is not a systemlibrary (mostly OSX and Windows)



 user code can still link with GMP, even though the primitive operation use `bsdnt`

...  ...  @@ 18,15 +18,12 @@ This wiki page is meant as a scratchpad to describe the plans/ideas behind the 





## Roadmap









This is not yet a definite accepted plan but rather wishful thinking at this point






### For GHC 7.10.1






 Switch to `integergmp2` as default `INTEGER_LIBRARY`



 ***(done)*** Switch to `integergmp2` as default `INTEGER_LIBRARY`






 but leave `INTEGER_LIBRARY=integergmp` in place as buildoption



 We can leave the package name as `integergmp`, i.e. for



 ***(done)*** Leave the package name as `integergmp`, i.e. for






 `INTEGER_LIBRARY=integergmp` we end up with `integergmp0.5.1.0`, while for



 `INTEGER_LIBRARY=integergmp2` we end up with `integergmp1.0.0.0`.

...  ...  @@ 47,11 +44,11 @@ This is not yet a definite accepted plan but rather wishful thinking at this poi 


### Haskellside API Types






```



  Type representing /raw/ arbitraryprecision Naturals This is common type used by 'Natural' and 'Integer'. As this type consists of a single constructor wrapping a 'ByteArray#' it can be unpacked. Essential invariants:  'ByteArray#' size is an exact multiple of 'Word#' size  limbs are stored in leastsignificantlimbfirst order,  the mostsignificant limb must be nonzero, except for  @0@ which is represented as a 1limb.dataBigNat=BN#ByteArray#  Invariant: 'Jn#' and 'Jp#' are used iff value doesn't fit in 'SI#' Useful properties resulting from the invariants:  @abs ('S#' _) <= abs ('Jp#' _)@  @abs ('S#' _) < abs ('Jn#' _)@dataInteger=S#Int# ^ iff value in @[minBound::'Int', maxBound::'Int']@ rangeJp#{# UNPACK #}!BigNat ^ iff value in @]maxBound::'Int', +inf[@ rangeJn#{# UNPACK #}!BigNat ^ iff value in @]inf, minBound::'Int'[@ range  Type representing arbitraryprecision Naturals Invariant: 'NatJ#' is used iff when value doesn't fit in 'NatS#'dataNatural=NatS#Word# ^ @[0, maxBound::Word]@NatJ#{# UNPACK #}!BigNat ^ @]maxBound::GmpLimb, +inf[@deriving(Eq,Ord)



  Type representing /raw/ arbitraryprecision Naturals This is common type used by 'Natural' and 'Integer'. As this type consists of a single constructor wrapping a 'ByteArray#' it can be unpacked. Essential invariants:  'ByteArray#' size is an exact multiple of 'Word#' size  limbs are stored in leastsignificantlimbfirst order,  the mostsignificant limb must be nonzero, except for  @0@ which is represented as a 1limb.dataBigNat=BN#ByteArray#  Invariant: 'Jn#' and 'Jp#' are used iff value doesn't fit in 'SI#' Useful properties resulting from the invariants:  @abs ('S#' _) <= abs ('Jp#' _)@  @abs ('S#' _) < abs ('Jn#' _)@dataInteger=S#Int# ^ iff value in @[minBound::'Int', maxBound::'Int']@ rangeJp#{# UNPACK #}!BigNat ^ iff value in @]maxBound::'Int', +inf[@ rangeJn#{# UNPACK #}!BigNat ^ iff value in @]inf, minBound::'Int'[@ rangederiving(Eq)  Type representing arbitraryprecision Naturals Invariant: 'NatJ#' is used iff when value doesn't fit in 'NatS#'dataNatural=NatS#Word# ^ @[0, maxBound::Word]@NatJ#{# UNPACK #}!BigNat ^ @]maxBound::GmpLimb, +inf[@deriving(Eq,Ord)



```






 `BigNat` is a internal common type to `Integer` and `Natural` and not exposed through `base`



 `Natural` finally fills the gap of the missing unsigned `Integer` counterpart in `base`



 `BigNat` is an internal common type to `Integer` and `Natural` and not exposed through `base`



 `Natural` ([\#9818](https://gitlab.haskell.org//ghc/ghc/issues/9818)) finally fills the gap of the missing unsigned `Integer` counterpart in `base`






 requires fallback implementation (on top of `Integer`) in `base` if `integer{simple,gmp}` are still to be supported




...  ...  