Safe Haskell | None |
---|---|
Language | Haskell2010 |
Bit putter
Synopsis
- data BitPutState = BitPutState {}
- newBitPutState :: BitOrder -> BitPutState
- putBits :: (Integral a, Bits a, ReversableBits a) => Word -> a -> BitPutState -> BitPutState
- putBitsBuffer :: Buffer -> BitPutState -> BitPutState
- getBitPutBuffer :: BitPutState -> Buffer
- getBitPutBufferList :: BitPutState -> BufferList
- type BitPut a = BitPutT Identity a
- type BitPutT m a = StateT BitPutState m a
- runBitPut :: BitOrder -> BitPut a -> Buffer
- runBitPutT :: Monad m => BitOrder -> BitPutT m a -> m Buffer
- putBitsM :: (Monad m, Integral a, Bits a, ReversableBits a) => Word -> a -> BitPutT m ()
- putBitBoolM :: Monad m => Bool -> BitPutT m ()
- putBitsBufferM :: Monad m => Buffer -> BitPutT m ()
- changeBitPutOrder :: Monad m => BitOrder -> BitPutT m ()
- withBitPutOrder :: Monad m => BitOrder -> BitPutT m a -> BitPutT m a
Documentation
data BitPutState Source #
BitPut state
BitPutState | |
|
newBitPutState :: BitOrder -> BitPutState Source #
Create a new BitPut state
putBits :: (Integral a, Bits a, ReversableBits a) => Word -> a -> BitPutState -> BitPutState Source #
Put bits
putBitsBuffer :: Buffer -> BitPutState -> BitPutState Source #
Put a Buffer
Examples: 3 bits are already written in the current byte
BB: ABCDEFGH IJKLMNOP -> xxxABCDE FGHIJKLM NOPxxxxx
LL: ABCDEFGH IJKLMNOP -> LMNOPxxx DEFGHIJK xxxxxABC
BL: ABCDEFGH IJKLMNOP -> xxxPONML KJIHGFED CBAxxxxx
LB: ABCDEFGH IJKLMNOP -> EDCBAxxx MLKJIHGF xxxxxPON
getBitPutBuffer :: BitPutState -> Buffer Source #
Get a Buffer
getBitPutBufferList :: BitPutState -> BufferList Source #
Get a buffer list
Monadic
type BitPutT m a = StateT BitPutState m a Source #
BitPut monad transformer
putBitsM :: (Monad m, Integral a, Bits a, ReversableBits a) => Word -> a -> BitPutT m () Source #
Put bits (monadic)