summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-05-21 14:34:36 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-24 09:48:27 -0400
commita3665a7aa5db8a77809b8e2246b8cd7eee86935c (patch)
tree9e73f89fc681a141554f90a529e3ebb92fbc7f80
parent098c7794953ee11334b6a450e6eda598a7ee09dc (diff)
downloadhaskell-a3665a7aa5db8a77809b8e2246b8cd7eee86935c.tar.gz
docs: Fix example in toIntegralSized
Thanks to Mathnerd3141 for the fixed example. Fixes #19880
-rw-r--r--libraries/base/GHC/Bits.hs6
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