gray-code 0.2 → 0.2.1
raw patch · 2 files changed
+11/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Codec.Binary.Gray.List: toList' :: Bits b => b -> [Bool]
Files
- Codec/Binary/Gray/List.hs +10/−2
- gray-code.cabal +1/−1
Codec/Binary/Gray/List.hs view
@@ -9,7 +9,7 @@ -- Second ed. (2004), 5.4. Gray Codes. module Codec.Binary.Gray.List ( gray, binary- , toList, fromList+ , toList, toList', fromList , showBits ) where @@ -33,7 +33,7 @@ go c bs@(b:_) = b `boolXOR` c : bs -- | Convert a number to a list of bits in usual binary encoding (most--- significant last).+-- significant bit last). Truncates unset major bits. -- -- This function is undefined for negative numbers of types that do not -- have fixed bitsize, like 'Integer'.@@ -46,6 +46,14 @@ | otherwise = let rest = toList $ shiftR i 1 -- works only for positive i in (testBit i 0 : rest)++-- | Convert a number to a list of bits in usual binary encoding (most+-- significant bit last).+--+-- Like 'toList', but returns all unset major bits too. So the length+-- of the output is always the same length as @bitSize i@.+toList' :: (Bits b) => b -> [Bool]+toList' i = map (testBit i) [0..bitSize i - 1] -- | Convert a list of bits in binary encoding to a number. fromList :: (Bits b) => [Bool] -> b
gray-code.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.2+Version: 0.2.1 -- A short (one-line) description of the package. Synopsis: Gray code encoder/decoder.