bit-protocol-0.1.0.0: Encode binary protocols with some odd bit numbers into a bytestring

Safe HaskellNone
LanguageHaskell2010

Data.BitProtocol

Synopsis

Documentation

data BitsVal a Source #

Constructors

BitsVal 

Fields

Instances
Eq a => Eq (BitsVal a) Source # 
Instance details

Defined in Data.BitProtocol

Methods

(==) :: BitsVal a -> BitsVal a -> Bool #

(/=) :: BitsVal a -> BitsVal a -> Bool #

Show a => Show (BitsVal a) Source # 
Instance details

Defined in Data.BitProtocol

Methods

showsPrec :: Int -> BitsVal a -> ShowS #

show :: BitsVal a -> String #

showList :: [BitsVal a] -> ShowS #

Num a => Semigroup (BitsVal a) Source # 
Instance details

Defined in Data.BitProtocol

Methods

(<>) :: BitsVal a -> BitsVal a -> BitsVal a #

sconcat :: NonEmpty (BitsVal a) -> BitsVal a #

stimes :: Integral b => b -> BitsVal a -> BitsVal a #

Integral a => Monoid (BitsVal a) Source #

WARNING! Can overflow, so only concat on a small number of items

Instance details

Defined in Data.BitProtocol

Methods

mempty :: BitsVal a #

mappend :: BitsVal a -> BitsVal a -> BitsVal a #

mconcat :: [BitsVal a] -> BitsVal a #

bitsValBiggerToCharUnsafe :: Integral a => BitsVal a -> ([Word8], BitsVal a) Source #

Convert left 8 bits to a list of Word8, while giving a leftover value). Assumes that the BitsVal argument's length is more than 8.

bitsValsToBS8 :: Integral a => [BitsVal a] -> ByteString Source #

Converts a list of chars into a bytestring via construction of 8-bit chars. Pads with zeroes on the right if a sum is not divisible by 8.