From 6c8f80d8876965539571d37d3c7f0fee43c300d2 Mon Sep 17 00:00:00 2001 From: Andreas Klebinger Date: Tue, 24 Mar 2020 18:14:09 +0100 Subject: Correct haddocks for testBit in Data.Bits It conflated the nth bit with the bit at offset n. Now we instead give the definition in terms of `bit and `.&.` on top of clearer phrasing. --- libraries/base/Data/Bits.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libraries') diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs index fd26d4e297..6379f208a8 100644 --- a/libraries/base/Data/Bits.hs +++ b/libraries/base/Data/Bits.hs @@ -168,10 +168,14 @@ class Eq a => Bits a where -- | @x \`complementBit\` i@ is the same as @x \`xor\` bit i@ complementBit :: a -> Int -> a - -- | Return 'True' if the @n@th bit of the argument is 1 - -- - -- Can be implemented using `testBitDefault' if @a@ is also an - -- instance of 'Num'. + {-| @x \`testBit\` i@ is the same as @x .&. bit n == 1@ + + In other words it returns True if the bit at offset @n + is set. + + Can be implemented using `testBitDefault' if @a@ is also an + instance of 'Num'. + -} testBit :: a -> Int -> Bool {-| Return the number of bits in the type of the argument. The actual -- cgit v1.2.1