summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-11-22 14:56:53 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2014-11-22 15:14:02 +0100
commitb836139099fc203a8b94849655d7dfb95dd80f4a (patch)
tree9d7e6eb9cc0443dc1dd63bbda68f584e6f563104 /libraries
parent4b6537677fa9460ca5febe2eb79a2d9d5bdadba2 (diff)
downloadhaskell-b836139099fc203a8b94849655d7dfb95dd80f4a.tar.gz
Fix `fromInteger` constructing invalid `Natural`
This fixes a case where `isValidNatural . fromInteger` would be `False`. Re #9818
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/GHC/Natural.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries/base/GHC/Natural.hs b/libraries/base/GHC/Natural.hs
index 0dead29e64..38a705e87e 100644
--- a/libraries/base/GHC/Natural.hs
+++ b/libraries/base/GHC/Natural.hs
@@ -158,7 +158,7 @@ instance Read Natural where
instance Num Natural where
fromInteger (S# i#) | I# i# >= 0 = NatS# (int2Word# i#)
- fromInteger (Jp# bn#) = NatJ# bn#
+ fromInteger (Jp# bn) = bigNatToNatural bn
fromInteger _ = throw Underflow
(+) = plusNatural