Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type Input = ByteString
- type Table a = [(Word8, a)]
- split :: Table Float -> (Table Float, Table Float)
- chunksOf :: Int -> ByteString -> [ByteString]
- decode :: ByteString -> ByteString
- compressChunk :: ByteString -> Word8
- compressWithLeftover :: ByteString -> ByteString
- decompressWithLeftover :: ByteString -> ByteString
Documentation
type Input = ByteString Source #
Simple type alias to distinguish when something is an input or is
a coded or compressed Bytestring
.
split :: Table Float -> (Table Float, Table Float) Source #
Auxiliary split function.
This function splits a probabilities table in half where the sum of the two halfs are as close as possible.
chunksOf :: Int -> ByteString -> [ByteString] Source #
Creates a list of Bytestring
chunks.
decode :: ByteString -> ByteString Source #
Takes a compressed Bytestring
and converts it into a Bytestring
of
only 0s and 1s.
compressChunk :: ByteString -> Word8 Source #
Takes a Bytestring
of 0s and 1s with length 8 and converts it to
a single Word8
.
Example:
compressChunk "00000001" == 1
compressWithLeftover :: ByteString -> ByteString Source #
The same as compress
but adds the size of the last byte to the
beginning of the compressed ByteString
, since it might occupy less
than 8 bits.
decompressWithLeftover :: ByteString -> ByteString Source #
Takes a compressed Bytestring
and converts it into a Bytestring
of
only 0s and 1s, truncating the last byte accordingly, using the
information of the last byte's size.