summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Bits.hs
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2013-09-21 14:10:32 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2013-09-21 14:10:32 +0200
commit957511b3816ec58c02fd33d5d115f7f6eef2b6b8 (patch)
tree32ceb6c99ecd5f1635bf8be3bf88572e6584271e /libraries/base/Data/Bits.hs
parentad89699497ee475c22a72d46d9569cd7769c57f6 (diff)
downloadhaskell-957511b3816ec58c02fd33d5d115f7f6eef2b6b8.tar.gz
Add Haddock docs for new `class FiniteBits`
Diffstat (limited to 'libraries/base/Data/Bits.hs')
-rw-r--r--libraries/base/Data/Bits.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs
index fb71d75473..d32d45ddf8 100644
--- a/libraries/base/Data/Bits.hs
+++ b/libraries/base/Data/Bits.hs
@@ -244,7 +244,20 @@ class Eq a => Bits a where
(rotate | (rotateL, rotateR)),
bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-}
+-- |The 'FiniteBits' class denotes types with a finite, fixed number of bits.
+--
+-- /Since: 4.7.0.0/
class Bits b => FiniteBits b where
+ -- | Return the number of bits in the type of the argument.
+ -- The actual value of the argument is ignored. Moreover, 'finiteBitSize'
+ -- is total, in contrast to the deprecated 'bitSize' function it replaces.
+ --
+ -- @
+ -- 'finiteBitSize' = 'bitSize'
+ -- 'bitSizeMaybe' = 'Just' . 'finiteBitSize'
+ -- @
+ --
+ -- /Since: 4.7.0.0/
finiteBitSize :: b -> Int
-- The defaults below are written with lambdas so that e.g.