ref: 294d5d962a79772f4fb4feb02b3249cdc0ce146b
parent: 61eb00e93d1cf875a7d2d6d86fd3bbd3dd528e16
author: Lennart Augustsson <lennart@augustsson.net>
date: Sat Nov 4 17:12:25 EDT 2023
Portable definitions for Bounded.
--- a/lib/Data/Int.hs
+++ b/lib/Data/Int.hs
@@ -34,8 +34,8 @@
toInteger = _intToInteger
instance Bounded Int where
- minBound = -9223372036854775808::Int -- -2^63
- maxBound = 9223372036854775807::Int -- 2^63-1
+ minBound = primWordToInt ((-1::Word) `primWordQuot` 2) + 1
+ maxBound = primWordToInt ((-1::Word) `primWordQuot` 2)
instance Real Int where
toRational i = _integerToRational (_intToInteger i)
--- a/lib/Data/Word.hs
+++ b/lib/Data/Word.hs
@@ -31,7 +31,7 @@
instance Bounded Word where
minBound = 0::Word
- maxBound = 18446744073709551615::Word -- 2^64-1
+ maxBound = (-1::Word)
instance Real Word where
toRational i = _integerToRational (_wordToInteger i)
--
⑨