From: PHO Date: Tue, 11 Jan 2011 11:08:08 +0000 (+0900) Subject: haddock comments X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=wavpack.git;a=commitdiff_plain;h=16211cdd0d7ebd32f10e224ab11bebc8be6fecb5 haddock comments --- diff --git a/Codec/Audio/WavPack/BitString.hs b/Codec/Audio/WavPack/BitString.hs index 1130276..577e09f 100644 --- a/Codec/Audio/WavPack/BitString.hs +++ b/Codec/Audio/WavPack/BitString.hs @@ -52,6 +52,8 @@ data BitString } deriving Show +-- | /O(n)/ The bitstrings must have finite lengths to test the +-- equality. instance Eq BitString where a == b = leftRem a' ≡ leftRem b' ∧ leftBytes a' ≡ leftBytes b' ∧ @@ -289,7 +291,8 @@ null bs ∧ remNull (rightRem bs) --- | /O(n)/ Return the number of bits in a 'BitString'. +-- | /O(n)/ @'length' bs@ returns the number of bits in @bs@. @bs@ +-- must have a finite length. length ∷ Integral n ⇒ BitString → n length bs = fromIntegral $ ( fromIntegral (remLen $ leftRem bs) @@ -311,16 +314,18 @@ fromByteString bs = BitString { , rightRem = remEmpty } --- | /O(n)/ Convert a 'BitString' into 'L.ByteString', padding --- incomplete bytes to single bytes with necessary 0's at their --- MSB. Thus the following equation does not hold when the length of --- 'BitString' isn't multiple of 8. +-- | /O(n)/ @'toByteString' bs@ converts @bs@ into 'L.ByteString', +-- padding incomplete bytes to single bytes with necessary 0's at +-- their MSB. Thus the following equation does not hold when the +-- length of @bs@ isn't multiple of 8. -- -- > fromByteString . toByteString = id -- -- But the following always holds true. -- -- > toByteString . fromByteString = id +-- +-- Note that @bs@ must have a finite length. toByteString ∷ BitString → L.ByteString toByteString bs = L.concat [ remToStr $ leftRem bs