summaryrefslogtreecommitdiff
path: root/libraries/ghc-bignum
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-10-06 12:39:35 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-07 20:20:01 -0400
commit3a5a5c859b59f596043b4c091d944f2a9951d0a2 (patch)
tree2cb9896162ba2025e3faeefc56fdd4136aafe0bb /libraries/ghc-bignum
parent44886aaba46230de003fb99153a3120667225302 (diff)
downloadhaskell-3a5a5c859b59f596043b4c091d944f2a9951d0a2.tar.gz
Bignum: allow naturalToWordClamp/Negate/Signum to inline (#20361)
We don't need built-in rules now that bignum literals (e.g. 123 :: Natural) match with their constructors (e.g. NS 123##).
Diffstat (limited to 'libraries/ghc-bignum')
-rw-r--r--libraries/ghc-bignum/src/GHC/Num/Natural.hs6
1 files changed, 0 insertions, 6 deletions
diff --git a/libraries/ghc-bignum/src/GHC/Num/Natural.hs b/libraries/ghc-bignum/src/GHC/Num/Natural.hs
index a494ccee70..bf83b01a71 100644
--- a/libraries/ghc-bignum/src/GHC/Num/Natural.hs
+++ b/libraries/ghc-bignum/src/GHC/Num/Natural.hs
@@ -114,7 +114,6 @@ naturalToWord !n = W# (naturalToWord# n)
-- | Convert a Natural into a Word# clamping to (maxBound :: Word#).
naturalToWordClamp# :: Natural -> Word#
-{-# NOINLINE naturalToWordClamp# #-}
naturalToWordClamp# (NS x) = x
naturalToWordClamp# (NB _) = WORD_MAXBOUND##
@@ -325,13 +324,11 @@ naturalSqr !a = naturalMul a a
-- | Signum for Natural
naturalSignum :: Natural -> Natural
-{-# NOINLINE naturalSignum #-}
naturalSignum (NS 0##) = NS 0##
naturalSignum _ = NS 1##
-- | Negate for Natural
naturalNegate :: Natural -> Natural
-{-# NOINLINE naturalNegate #-}
naturalNegate (NS 0##) = NS 0##
naturalNegate _ = raiseUnderflow
@@ -589,9 +586,6 @@ naturalFromByteArray# sz ba off e s = case bigNatFromByteArray# sz ba off e s of
"Word# -> Natural -> Word#"
forall x. naturalToWord# (NS x) = x
-"Word# -> Natural -> Word# (clamp)"
- forall x. naturalToWordClamp# (NS x) = x
-
"BigNat# -> Natural -> BigNat#"
forall x. naturalToBigNat# (naturalFromBigNat# x) = x
#-}