[Git][ghc/ghc][wip/andreask/bits_docs] Correct haddocks for testBit in Data.Bits

Andreas Klebinger gitlab at gitlab.haskell.org
Tue Mar 24 17:18:13 UTC 2020



Andreas Klebinger pushed to branch wip/andreask/bits_docs at Glasgow Haskell Compiler / GHC


Commits:
0fcb2a0a by Andreas Klebinger at 2020-03-24T18:18:02+01: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.

- - - - -


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 == 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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0fcb2a0adcdf0140170f050af2d3e865bd4e8fe6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0fcb2a0adcdf0140170f050af2d3e865bd4e8fe6
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/20200324/08d488df/attachment.html>


More information about the ghc-commits mailing list