| Copyright | (c) Daniel Lovasko 2016-2017 |
|---|---|
| License | BSD3 |
| Maintainer | Daniel Lovasko <daniel.lovasko@gmail.com> |
| Stability | stable |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Codec.Goat.Util
Description
Various utility functions used throughout the codebase.
- aiGetByteString :: Get ByteString
- aiPutByteString :: ByteString -> Put
- bool :: a -> a -> Bool -> a
- first :: (a -> b) -> (a, x) -> (b, x)
- fromBools :: (Num b, FiniteBits b) => [Bool] -> b
- inBounds :: Ord a => (a, a) -> a -> Bool
- packBits :: [Bool] -> ByteString
- select :: [a] -> [Bool] -> [a]
- sub :: Word32 -> Word32 -> Int64
- toBools :: FiniteBits b => b -> [Bool]
- unpackBits :: ByteString -> [Bool]
Documentation
Arguments
| :: Get ByteString | reader |
Architecture-independent deserialization of a lazy ByteString.
Arguments
| :: ByteString | bytestring to parse |
| -> Put | writer |
Architecture-independent serialization of a strict ByteString.
Arguments
| :: a | True option |
| -> a | False option |
| -> Bool | bool |
| -> a | result |
Functional equivalent of the 'if/then/else' construct.
Arguments
| :: (a -> b) | function |
| -> (a, x) | old pair |
| -> (b, x) | new pair |
Apply a function to the first element of a pair.
Arguments
| :: (Num b, FiniteBits b) | |
| => [Bool] | bits |
| -> b | Bits instance |
Convert a list of bools into a Bits instance.
Check whether a value falls between the bounds (inclusive).
Arguments
| :: [Bool] | bits |
| -> ByteString | bytestring |
Pack a list of bits into a more compact form.
Arguments
| :: [a] | list |
| -> [Bool] | presence flags |
| -> [a] | filtered list |
Select only certain elements from the list based on the boolean values.
Correct subtraction of two unsigned integers.
Arguments
| :: FiniteBits b | |
| => b | Bits instance |
| -> [Bool] | bits |
Convert a Bits instance into a list of bools.
Arguments
| :: ByteString | bits |
| -> [Bool] | bytestring |
Unpack a compact block of bytes into a list of bools.