bitwise 0.1 → 0.1.0.1
raw patch · 8 files changed
+28/−28 lines, 8 filesdep ~basedep ~bitwisePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bitwise
API changes (from Hackage documentation)
- Codec.Image.PBM: PBM :: !Int -> !BitArray (Int, Int) -> PBM
+ Codec.Image.PBM: PBM :: !Int -> !(BitArray (Int, Int)) -> PBM
- Codec.Image.PBM: pbmPixels :: PBM -> !BitArray (Int, Int)
+ Codec.Image.PBM: pbmPixels :: PBM -> !(BitArray (Int, Int))
- Data.Bits.Bitwise: all :: Bits b => (Bool -> Bool) -> b -> Bool
+ Data.Bits.Bitwise: all :: (Num b, Bits b) => (Bool -> Bool) -> b -> Bool
- Data.Bits.Bitwise: and :: Bits b => b -> Bool
+ Data.Bits.Bitwise: and :: (Num b, Bits b) => b -> Bool
- Data.Bits.Bitwise: any :: Bits b => (Bool -> Bool) -> b -> Bool
+ Data.Bits.Bitwise: any :: (Num b, Bits b) => (Bool -> Bool) -> b -> Bool
- Data.Bits.Bitwise: fromBool :: Bits b => Bool -> b
+ Data.Bits.Bitwise: fromBool :: (Num b, Bits b) => Bool -> b
- Data.Bits.Bitwise: fromListBE :: Bits b => [Bool] -> b
+ Data.Bits.Bitwise: fromListBE :: (Num b, Bits b) => [Bool] -> b
- Data.Bits.Bitwise: fromListLE :: Bits b => [Bool] -> b
+ Data.Bits.Bitwise: fromListLE :: (Num b, Bits b) => [Bool] -> b
- Data.Bits.Bitwise: isUniform :: Bits b => b -> Maybe Bool
+ Data.Bits.Bitwise: isUniform :: (Num b, Bits b) => b -> Maybe Bool
- Data.Bits.Bitwise: joinAt :: Bits b => Int -> b -> b -> b
+ Data.Bits.Bitwise: joinAt :: (Num b, Bits b) => Int -> b -> b -> b
- Data.Bits.Bitwise: map :: Bits b => (Bool -> Bool) -> b -> b
+ Data.Bits.Bitwise: map :: (Num b, Bits b) => (Bool -> Bool) -> b -> b
- Data.Bits.Bitwise: mask :: Bits b => Int -> b
+ Data.Bits.Bitwise: mask :: (Num b, Bits b) => Int -> b
- Data.Bits.Bitwise: or :: Bits b => b -> Bool
+ Data.Bits.Bitwise: or :: (Num b, Bits b) => b -> Bool
- Data.Bits.Bitwise: repeat :: Bits b => Bool -> b
+ Data.Bits.Bitwise: repeat :: (Num b, Bits b) => Bool -> b
- Data.Bits.Bitwise: splitAt :: Bits b => Int -> b -> (b, b)
+ Data.Bits.Bitwise: splitAt :: (Num b, Bits b) => Int -> b -> (b, b)
- Data.Bits.Bitwise: toListBE :: Bits b => b -> [Bool]
+ Data.Bits.Bitwise: toListBE :: (Num b, Bits b) => b -> [Bool]
- Data.Bits.Bitwise: toListLE :: Bits b => b -> [Bool]
+ Data.Bits.Bitwise: toListLE :: (Num b, Bits b) => b -> [Bool]
- Data.Bits.Bitwise: zipWith :: Bits b => (Bool -> Bool -> Bool) -> b -> b -> b
+ Data.Bits.Bitwise: zipWith :: (Num b, Bits b) => (Bool -> Bool -> Bool) -> b -> b -> b
Files
- bitwise.cabal +5/−5
- src/Codec/Image/PBM.hs +1/−1
- src/Data/Array/BitArray.hs +1/−1
- src/Data/Array/BitArray/ByteString.hs +1/−1
- src/Data/Array/BitArray/IO.hs +1/−1
- src/Data/Array/BitArray/Internal.hs +1/−1
- src/Data/Array/BitArray/ST.hs +1/−1
- src/Data/Bits/Bitwise.hs +17/−17
bitwise.cabal view
@@ -1,5 +1,5 @@ Name: bitwise-Version: 0.1+Version: 0.1.0.1 Synopsis: fast multi-dimensional unboxed bit packed Bool arrays Description: Unboxed multidimensional bit packed Bool arrays with fast aggregate@@ -49,7 +49,7 @@ License: BSD3 License-file: LICENSE Author: Claude Heiland-Allen-Maintainer: claudiusmaximus@goto10.org+Maintainer: claude@mathr.co.uk Copyright: (c) 2012 Claude Heiland-Allen Category: Data, Data Structures, Bit Vectors Build-type: Simple@@ -92,7 +92,7 @@ type: exitcode-stdio-1.0 main-is: extra/testsuite.hs build-depends:- bitwise == 0.1,+ bitwise == 0.1.0.1, base >= 2 && < 6, QuickCheck >= 2.4 && < 2.5 @@ -100,7 +100,7 @@ type: exitcode-stdio-1.0 main-is: extra/benchmark.hs build-depends:- bitwise == 0.1,+ bitwise == 0.1.0.1, base >= 2 && < 6, array, bytestring,@@ -113,4 +113,4 @@ source-repository this type: git location: git://gitorious.org/bitwise/bitwise.git- tag: v0.1+ tag: v0.1.0.1
src/Codec/Image/PBM.hs view
@@ -6,7 +6,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : portable
src/Data/Array/BitArray.hs view
@@ -4,7 +4,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : portable
src/Data/Array/BitArray/ByteString.hs view
@@ -4,7 +4,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : portable
src/Data/Array/BitArray/IO.hs view
@@ -4,7 +4,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : portable
src/Data/Array/BitArray/Internal.hs view
@@ -5,7 +5,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : portable
src/Data/Array/BitArray/ST.hs view
@@ -4,7 +4,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : uses ST
src/Data/Bits/Bitwise.hs view
@@ -4,7 +4,7 @@ Copyright : (c) Claude Heiland-Allen 2012 License : BSD3 -Maintainer : claudiusmaximus@goto10.org+Maintainer : claude@mathr.co.uk Stability : unstable Portability : portable @@ -50,7 +50,7 @@ -- | Lift a boolean constant to a bitwise constant. {-# INLINE repeat #-}-repeat :: Bits b => Bool -> b+repeat :: (Num b, Bits b) => Bool -> b repeat False = 0 repeat True = complement 0 @@ -60,7 +60,7 @@ -- thus the operation provided must be total. -- {-# INLINE map #-}-map :: Bits b => (Bool -> Bool) {- ^ operation -} -> b -> b+map :: (Num b, Bits b) => (Bool -> Bool) {- ^ operation -} -> b -> b map f = case (f False, f True) of (False, False) -> \_ -> 0 (False, True ) -> id@@ -73,7 +73,7 @@ -- thus the operation provided must be total. -- {-# INLINE zipWith #-}-zipWith :: Bits b => (Bool -> Bool -> Bool) {- ^ operation -} -> b -> b -> b+zipWith :: (Num b, Bits b) => (Bool -> Bool -> Bool) {- ^ operation -} -> b -> b -> b zipWith f = case (f False False, f False True, f True False, f True True) of (False, False, False, False) -> \_ _ -> 0 (False, False, False, True ) -> (.&.)@@ -96,27 +96,27 @@ -- | True when any bit is set. {-# INLINE or #-}-or :: Bits b => b -> Bool+or :: (Num b, Bits b) => b -> Bool or b = b /= 0 -- | True when all bits are set. {-# INLINE and #-}-and :: Bits b => b -> Bool+and :: (Num b, Bits b) => b -> Bool and b = b == complement 0 -- | True when the predicate is true for any bit. {-# INLINE any #-}-any :: Bits b => (Bool -> Bool) {- ^ predicate -} -> b -> Bool+any :: (Num b, Bits b) => (Bool -> Bool) {- ^ predicate -} -> b -> Bool any f = or . map f -- | True when the predicate is true for all bits. {-# INLINE all #-}-all :: Bits b => (Bool -> Bool) {- ^ predicate -} -> b -> Bool+all :: (Num b, Bits b) => (Bool -> Bool) {- ^ predicate -} -> b -> Bool all f = and . map f -- | Determine if a 'Bits' is all 1s, all 0s, or neither. {-# INLINE isUniform #-}-isUniform :: Bits b => b -> Maybe Bool+isUniform :: (Num b, Bits b) => b -> Maybe Bool isUniform b | b == 0 = Just False | b == complement 0 = Just True@@ -124,19 +124,19 @@ -- | A mask with count least significant bits set. {-# INLINE mask #-}-mask :: Bits b => Int {- ^ count -} -> b+mask :: (Num b, Bits b) => Int {- ^ count -} -> b mask n = bit n - bit 0 -- | Split a word into (lsb, msb). Ensures lsb has no set bits -- above the split point. {-# INLINE splitAt #-}-splitAt :: Bits b => Int {- ^ split point -} -> b {- ^ word -} -> (b, b) {- ^ (lsb, msb) -}+splitAt :: (Num b, Bits b) => Int {- ^ split point -} -> b {- ^ word -} -> (b, b) {- ^ (lsb, msb) -} splitAt n b = (b .&. mask n, b `shiftR` n) -- | Join lsb with msb to make a word. Assumes lsb has no set bits -- above the join point. {-# INLINE joinAt #-}-joinAt :: Bits b => Int {- ^ join point -} -> b {- ^ least significant bits -} -> b {- ^ most significant bits -} -> b {- ^ word -}+joinAt :: (Num b, Bits b) => Int {- ^ join point -} -> b {- ^ least significant bits -} -> b {- ^ most significant bits -} -> b {- ^ word -} joinAt n lsb msb = lsb .|. (msb `shiftL` n) -- | Pack bits into a byte in little-endian order.@@ -165,13 +165,13 @@ -- | The least significant bit. {-# INLINE fromBool #-}-fromBool :: Bits b => Bool -> b+fromBool :: (Num b, Bits b) => Bool -> b fromBool False = 0 fromBool True = bit 0 -- | Convert a little-endian list of bits to 'Bits'. {-# INLINE fromListLE #-}-fromListLE :: Bits b => [Bool] {- ^ \[least significant bit, ..., most significant bit\] -} -> b+fromListLE :: (Num b, Bits b) => [Bool] {- ^ \[least significant bit, ..., most significant bit\] -} -> b fromListLE = foldr f 0 where f b i = fromBool b .|. (i `shiftL` 1)@@ -179,12 +179,12 @@ -- | Convert a 'Bits' (with a defined 'bitSize') to a list of bits, in -- little-endian order. {-# INLINE toListLE #-}-toListLE :: Bits b => b -> [Bool] {- ^ \[least significant bit, ..., most significant bit\] -}+toListLE :: (Num b, Bits b) => b -> [Bool] {- ^ \[least significant bit, ..., most significant bit\] -} toListLE b = P.map (testBit b) [0 .. bitSize b - 1] -- | Convert a big-endian list of bits to 'Bits'. {-# INLINE fromListBE #-}-fromListBE :: Bits b => [Bool] {- ^ \[most significant bit, ..., least significant bit\] -} -> b+fromListBE :: (Num b, Bits b) => [Bool] {- ^ \[most significant bit, ..., least significant bit\] -} -> b fromListBE = foldl' f 0 where f i b = (i `shiftL` 1) .|. fromBool b@@ -192,5 +192,5 @@ -- | Convert a 'Bits' (with a defined 'bitSize') to a list of bits, in -- big-endian order. {-# INLINE toListBE #-}-toListBE :: Bits b => b -> [Bool] {- ^ \[most significant bit, ..., least significant bit\] -}+toListBE :: (Num b, Bits b) => b -> [Bool] {- ^ \[most significant bit, ..., least significant bit\] -} toListBE b = P.map (testBit b) [bitSize b - 1, bitSize b - 2 .. 0]