| Copyright | (c) Matthew Mosior 2022 |
|---|---|
| License | BSD-style |
| Maintainer | mattm.github@gmail.com |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.RLE.Internal
Description
WARNING
This module is considered internal.
The Package Versioning Policy does not apply.
The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.
Authors importing this library are expected to track development closely.
All credit goes to the author(s)/maintainer(s) of the containers library for the above warning text.
Description
Various data structures and custom data types to describe the Run-length encoding (RLE)
and the Inverse RLE implementations, namely vecToRLEB, vecToRLET, vecFromRLEB, and vecFromRLET.
The RLE implementations rely heavily upon Vector provided by the vector library,
STRef and associated functions in the stref library,
and runST in the Control.Monad.ST library.
Synopsis
- newtype RLEB = RLEB (Vector (Maybe ByteString))
- newtype RLET = RLET (Vector (Maybe Text))
- type RLEVecB = Vector (Maybe ByteString)
- type STRLEVecB s a = STRef s RLEVecB
- pushSTRLEVecB :: STRLEVecB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
- emptySTRLEVecB :: ST s (STRLEVecB s a)
- type STRLETempB s a = STRef s (Maybe ByteString)
- updateSTRLETempB :: STRLETempB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
- emptySTRLETempB :: ST s (STRLETempB s a)
- type STRLECounterB s a = STRef s Int
- updateSTRLECounterB :: STRLECounterB s Int -> Int -> ST s ()
- emptySTRLECounterB :: ST s (STRLECounterB s Int)
- vecToRLEB :: RLEVecB -> ST s RLEVecB
- type RLEVecT = Vector (Maybe Text)
- type STRLEVecT s a = STRef s RLEVecT
- pushSTRLEVecT :: STRLEVecT s (Maybe Text) -> Maybe Text -> ST s ()
- emptySTRLEVecT :: ST s (STRLEVecT s a)
- type STRLETempT s a = STRef s (Maybe Text)
- updateSTRLETempT :: STRLETempT s (Maybe Text) -> Maybe Text -> ST s ()
- emptySTRLETempT :: ST s (STRLETempT s a)
- type STRLECounterT s a = STRef s Int
- updateSTRLECounterT :: STRLECounterT s Int -> Int -> ST s ()
- emptySTRLECounterT :: ST s (STRLECounterT s Int)
- vecToRLET :: RLEVecT -> ST s RLEVecT
- unconsb2 :: Vector a -> Maybe (a, Vector a, Maybe (Vector a))
- type FRLEVecB = Vector (Maybe ByteString)
- type FSTRLEVecB s a = STRef s FRLEVecB
- pushFSTRLEVecB :: FSTRLEVecB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
- emptyFSTRLEVecB :: ST s (FSTRLEVecB s a)
- vecFromRLEB :: RLEB -> ST s FRLEVecB
- unconst2 :: Vector a -> Maybe (a, Vector a, Maybe (Vector a))
- type FRLEVecT = Vector (Maybe Text)
- type FSTRLEVecT s a = STRef s FRLEVecT
- pushFSTRLEVecT :: FSTRLEVecT s (Maybe Text) -> Maybe Text -> ST s ()
- emptyFSTRLEVecT :: ST s (FSTRLEVecT s a)
- vecFromRLET :: RLET -> ST s FRLEVecT
Documentation
Basic RLE (ByteString) data type.
Constructors
| RLEB (Vector (Maybe ByteString)) |
Basic RLE (Text) data type.
type STRLEVecB s a = STRef s RLEVecB Source #
Abstract data type representing a RLEVecB in the (strict) ST monad.
pushSTRLEVecB :: STRLEVecB s (Maybe ByteString) -> Maybe ByteString -> ST s () Source #
State function to push RLEVecB data into stack.
type STRLETempB s a = STRef s (Maybe ByteString) Source #
Abstract STRLETempB and associated state type.
updateSTRLETempB :: STRLETempB s (Maybe ByteString) -> Maybe ByteString -> ST s () Source #
State function to update STRLETempB.
emptySTRLETempB :: ST s (STRLETempB s a) Source #
State function to create empty STRLETempB type.
type STRLECounterB s a = STRef s Int Source #
Abstract STRLECounterB state type.
updateSTRLECounterB :: STRLECounterB s Int -> Int -> ST s () Source #
State function to update STRLECounterB.
emptySTRLECounterB :: ST s (STRLECounterB s Int) Source #
State function to create empty STRLECounterB type.
type STRLEVecT s a = STRef s RLEVecT Source #
Abstract data type representing a RLEVecT in the (strict) ST monad.
pushSTRLEVecT :: STRLEVecT s (Maybe Text) -> Maybe Text -> ST s () Source #
State function to push RLEVecT data into stack.
type STRLETempT s a = STRef s (Maybe Text) Source #
Abstract STRLETempT state type.
updateSTRLETempT :: STRLETempT s (Maybe Text) -> Maybe Text -> ST s () Source #
State function to update STRLETempT.
emptySTRLETempT :: ST s (STRLETempT s a) Source #
State function to create empty STRLETempT type.
type STRLECounterT s a = STRef s Int Source #
Abstract STRLECounterT and associated state type.
updateSTRLECounterT :: STRLECounterT s Int -> Int -> ST s () Source #
State function to update STRLECounterT.
emptySTRLECounterT :: ST s (STRLECounterT s Int) Source #
State function to create empty STRLECounterT type.
unconsb2 :: Vector a -> Maybe (a, Vector a, Maybe (Vector a)) Source #
Vector auxilary function
to pattern match on first two elements
of a vector.
type FSTRLEVecB s a = STRef s FRLEVecB Source #
Abstract data type representing a FRLEVecB in the (strict) ST monad.
pushFSTRLEVecB :: FSTRLEVecB s (Maybe ByteString) -> Maybe ByteString -> ST s () Source #
State function to push FRLEVecB data into stack.
emptyFSTRLEVecB :: ST s (FSTRLEVecB s a) Source #
State function to create empty FSTRLEVecB type.
unconst2 :: Vector a -> Maybe (a, Vector a, Maybe (Vector a)) Source #
Vector auxilary function
to pattern match on first two elements
of a vector.
type FSTRLEVecT s a = STRef s FRLEVecT Source #
Abstract data type representing a FRLEVecT in the (strict) ST monad.
pushFSTRLEVecT :: FSTRLEVecT s (Maybe Text) -> Maybe Text -> ST s () Source #
State function to push FSTRLEVecT data into stack.
emptyFSTRLEVecT :: ST s (FSTRLEVecT s a) Source #
State function to create empty FSTRLEVecT type.