diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-05-21 14:34:36 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-24 09:48:27 -0400 |
commit | a3665a7aa5db8a77809b8e2246b8cd7eee86935c (patch) | |
tree | 9e73f89fc681a141554f90a529e3ebb92fbc7f80 | |
parent | 098c7794953ee11334b6a450e6eda598a7ee09dc (diff) | |
download | haskell-a3665a7aa5db8a77809b8e2246b8cd7eee86935c.tar.gz |
docs: Fix example in toIntegralSized
Thanks to Mathnerd3141 for the fixed example.
Fixes #19880
-rw-r--r-- | libraries/base/GHC/Bits.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libraries/base/GHC/Bits.hs b/libraries/base/GHC/Bits.hs index d0703e223f..012550a60b 100644 --- a/libraries/base/GHC/Bits.hs +++ b/libraries/base/GHC/Bits.hs @@ -601,10 +601,10 @@ instance Bits Natural where -- -- > toIntegral :: (Integral a, Integral b) => a -> Maybe b -- > toIntegral x --- > | toInteger x == y = Just (fromInteger y) --- > | otherwise = Nothing +-- > | toInteger x == toInteger y = Just y +-- > | otherwise = Nothing -- > where --- > y = toInteger x +-- > y = fromIntegral x -- -- This version requires going through 'Integer', which can be inefficient. -- However, @toIntegralSized@ is optimized to allow GHC to statically determine |