Skip to content

Bignum: add Natural constant folding rules (#15821)

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/bignum/natfolding into master
* Implement constant folding rules for Natural (similar to Integer ones)

* Add mkCoreUbxSum helper in GHC.Core.Make

* Remove naturalTo/FromInt

  We now only provide `naturalTo/FromWord` as
  the semantics is clear (truncate/zero-extend). For Int we have to deal
  with negative numbers (throw an exception? convert to Word
  beforehand?) so we leave the decision about what to do to the caller.

  Moreover, now that we have sized types (Int8#, Int16#, ..., Word8#,
  etc.) there is no reason to bless `Int#` more than `Int8#` or `Word8#`
  (for example).

* Replaced a few `()` with `(# #)`
Edited by Sylvain Henry

Merge request reports