[Git][ghc/ghc][master] 2 commits: Correct haddocks for testBit in Data.Bits
Marge Bot
gitlab at gitlab.haskell.org
Sun Mar 29 21:32:13 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
6c8f80d8 by Andreas Klebinger at 2020-03-29T17:32:04-04:00
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.
- - - - -
c916f190 by Andreas Klebinger at 2020-03-29T17:32:04-04:00
Apply suggestion to libraries/base/Data/Bits.hs
- - - - -
1 changed file:
- libraries/base/Data/Bits.hs
Changes:
=====================================
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 at 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 /= 0@
+
+ 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
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7e7cb714173652165b8372c3450f4ccd6a377497...c916f190b455d9c43459f81c7ee06d06ab3db957
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7e7cb714173652165b8372c3450f4ccd6a377497...c916f190b455d9c43459f81c7ee06d06ab3db957
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200329/29d94c07/attachment.html>
More information about the ghc-commits
mailing list