bits-bytestring alternatives and similar packages
Based on the "bits" category.
Alternatively, view bits-bytestring alternatives based on common mentions on social networks and blogs.
Collect and Analyze Billions of Data Points in Real Time
Do you think we are missing an alternative of bits-bytestring or a related project?
README
bits-bytestring

A ByteString
instance for the Bits
typeclass, providing bitwise operators for n-bit blocks larger than Word64
.
Installation
To install bits-bytestring, use stack and add bits-bytestring-0.1.0.1
to extra-deps
in stack.yaml
:
extra-deps: [bits-bytestring-0.1.0.1]
Then add bits-bytestring
to your cabal file or just run:
stack install bits-bytestring
Usage
bits-bytestring
provides a Bits
typeclass instance for ByteString
, so all the bitwise operators from Data.Bits
are available with ByteString
s now. To access the instance, import Data.Bits.ByteString
. Example usage could be:
-- Minimal imports
import qualified Data.ByteString as B
import Data.Bits
import Data.Bits.ByteString
-- cryptohash example
import qualified Crypto.Hash.SHA512 as SHA512
main :: IO ()
main = do
let bs1 = SHA512.hash (B.pack [0..255])
let bs2 = (B.replicate 64 0)
print $ bs1 .&. bs2
print $ bs1 .|. bs2
print $ bs1 `xor` bs2
print $ shift bs1 5
print $ rotate bs1 13
Contributions
Pull requests and bug reports are welcome!
If you need to contact me, the following ways are best and in this order:
- Github: Post an issue or pull request
- Email me: [email protected], [email protected]
- IRC: #haskell, #haskell-beginners, #haskell-game