diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2014-11-04 11:06:53 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2014-11-04 11:06:53 +0100 |
commit | 828d72489a8bad79e3675deed4b90807052ca0ee (patch) | |
tree | 2059ee3fb9feda3981db196031debf5a0e9b6355 /libraries/base | |
parent | 4dbe4330e046c57c09feaa972a3fd513a55d601c (diff) | |
download | haskell-828d72489a8bad79e3675deed4b90807052ca0ee.tar.gz |
Refactor Haddock comments in Data.Bits
This removes the redundant "Minimal complete definition"-block included
in the Haddock comment since Haddock renders the `MINIMAL`-pragma as
well (which has is moved to the start of `class` definition for better
readability of the source code)
Morever, the references to `testBitDefault`, `bitDefault`, and
`popCountDefault` have been moved to the respective methods' Haddock
strings for which they can be used.
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/Data/Bits.hs | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs index cdef2fba52..fead6fb002 100644 --- a/libraries/base/Data/Bits.hs +++ b/libraries/base/Data/Bits.hs @@ -68,19 +68,16 @@ infixl 5 .|. {-# DEPRECATED bitSize "Use 'bitSizeMaybe' or 'finiteBitSize' instead" #-} -- deprecated in 7.8 -{-| -The 'Bits' class defines bitwise operations over integral types. - -* Bits are numbered from 0 with bit 0 being the least - significant bit. - -Minimal complete definition: '.&.', '.|.', 'xor', 'complement', -('shift' or ('shiftL' and 'shiftR')), ('rotate' or ('rotateL' and 'rotateR')), -'bitSize', 'isSigned', 'testBit', 'bit', and 'popCount'. The latter three can -be implemented using `testBitDefault', 'bitDefault', and 'popCountDefault', if -@a@ is also an instance of 'Num'. --} +-- | The 'Bits' class defines bitwise operations over integral types. +-- +-- * Bits are numbered from 0 with bit 0 being the least +-- significant bit. class Eq a => Bits a where + {-# MINIMAL (.&.), (.|.), xor, complement, + (shift | (shiftL, shiftR)), + (rotate | (rotateL, rotateR)), + bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + -- | Bitwise \"and\" (.&.) :: a -> a -> a @@ -155,6 +152,9 @@ class Eq a => Bits a where -- | @bit /i/@ is a value with the @/i/@th bit set and all other bits clear. -- + -- Can be implemented using `bitDefault' if @a@ is also an + -- instance of 'Num'. + -- -- See also 'zeroBits'. bit :: Int -> a @@ -168,6 +168,9 @@ class Eq a => Bits a where 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'. testBit :: a -> Int -> Bool {-| Return the number of bits in the type of the argument. The actual @@ -268,14 +271,12 @@ class Eq a => Bits a where {-| Return the number of set bits in the argument. This number is known as the population count or the Hamming weight. + Can be implemented using `popCountDefault' if @a@ is also an + instance of 'Num'. + /Since: 4.5.0.0/ -} popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, - (shift | (shiftL, shiftR)), - (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/ |