diff --git a/lib/Data/Int/Instances.hs b/lib/Data/Int/Instances.hs index 905c3d77..30fb7961 100644 --- a/lib/Data/Int/Instances.hs +++ b/lib/Data/Int/Instances.hs @@ -54,8 +54,8 @@ instance Integral Int8 where toInteger = _intToInteger . unI8 instance Bounded Int8 where - minBound = I8 0x80 - maxBound = I8 0x7f + minBound = i8 0x80 + maxBound = i8 0x7f instance Real Int8 where toRational = _integerToRational . _intToInteger . unI8 @@ -150,8 +150,8 @@ instance Integral Int16 where toInteger = _intToInteger . unI16 instance Bounded Int16 where - minBound = I16 0x8000 - maxBound = I16 0x7fff + minBound = i16 0x8000 + maxBound = i16 0x7fff instance Real Int16 where toRational = _integerToRational . _intToInteger . unI16 @@ -246,8 +246,8 @@ instance Integral Int32 where toInteger = _intToInteger . unI32 instance Bounded Int32 where - minBound = I32 0x80000000 - maxBound = I32 0x7fffffff + minBound = i32 0x80000000 + maxBound = i32 0x7fffffff instance Real Int32 where toRational = _integerToRational . _intToInteger . unI32 @@ -341,8 +341,8 @@ instance Integral Int64 where toInteger = _intToInteger . unI64 instance Bounded Int64 where - minBound = I64 0x8000000000000000 - maxBound = I64 0x7fffffffffffffff + minBound = i64 0x8000000000000000 + maxBound = i64 0x7fffffffffffffff instance Real Int64 where toRational = _integerToRational . _intToInteger . unI64 diff --git a/lib/Data/Word.hs b/lib/Data/Word.hs index 45f7566d..a67e70d6 100644 --- a/lib/Data/Word.hs +++ b/lib/Data/Word.hs @@ -141,8 +141,8 @@ instance Integral Word8 where toInteger = _wordToInteger . unW8 instance Bounded Word8 where - minBound = W8 0 - maxBound = W8 0xff + minBound = w8 0 + maxBound = w8 0xff instance Real Word8 where toRational = _integerToRational . _wordToInteger . unW8 @@ -239,8 +239,8 @@ instance Integral Word16 where toInteger = _wordToInteger . unW16 instance Bounded Word16 where - minBound = W16 0 - maxBound = W16 0xffff + minBound = w16 0 + maxBound = w16 0xffff instance Real Word16 where toRational = _integerToRational . _wordToInteger . unW16 @@ -336,8 +336,8 @@ instance Integral Word32 where toInteger = _wordToInteger . unW32 instance Bounded Word32 where - minBound = W32 0 - maxBound = W32 0xffffffff + minBound = w32 0 + maxBound = w32 0xffffffff instance Real Word32 where toRational = _integerToRational . _wordToInteger . unW32 @@ -434,8 +434,8 @@ instance Integral Word64 where toInteger = _wordToInteger . unW64 instance Bounded Word64 where - minBound = W64 0 - maxBound = W64 0xffffffffffffffff + minBound = w64 0 + maxBound = w64 0xffffffffffffffff instance Real Word64 where toRational = _integerToRational . _wordToInteger . unW64 diff --git a/tests/Bounded.hs b/tests/Bounded.hs new file mode 100644 index 00000000..537d60bb --- /dev/null +++ b/tests/Bounded.hs @@ -0,0 +1,16 @@ +module Bounded where + +import Data.Int +import Data.Word + +printBounds :: forall a. (Bounded a, Show a) => IO () +printBounds = print (minBound @a, maxBound @a) + +main :: IO () +main = do + printBounds @Int8 + printBounds @Int16 + printBounds @Int32 + printBounds @Word8 + printBounds @Word16 + printBounds @Word32 diff --git a/tests/Bounded.ref b/tests/Bounded.ref new file mode 100644 index 00000000..9586962d --- /dev/null +++ b/tests/Bounded.ref @@ -0,0 +1,6 @@ +(-128,127) +(-32768,32767) +(-2147483648,2147483647) +(0,255) +(0,65535) +(0,4294967295)