From 3a5a5c859b59f596043b4c091d944f2a9951d0a2 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Wed, 6 Oct 2021 12:39:35 +0200 Subject: 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##). --- libraries/ghc-bignum/src/GHC/Num/Natural.hs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'libraries') 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 #-} -- cgit v1.2.1