-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A text compression library.
--
-- This package contains efficient implementations of various text
-- compression algorithms.
@package text-compression
@version 0.1.0.21
-- |
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
-- Burrows-Wheeler Transform (BWT) and the Inverse BWT.
--
-- The implementation of the BWT relies upon Seq provided by the
-- containers.
--
-- The internal BWTMatrix data type relies upon the Seq as
-- well.
module Data.BWT.Internal
-- | Basic suffix data type. Used to describe the core data inside of the
-- SuffixArray data type.
data Suffix a
Suffix :: Int -> Int -> Maybe (Seq a) -> Suffix a
[suffixindex] :: Suffix a -> Int
[suffixstartpos] :: Suffix a -> Int
[suffix] :: Suffix a -> Maybe (Seq a)
-- | The SuffixArray data type. Uses Seq internally.
type SuffixArray a = Seq (Suffix a)
-- | The BWT data type. Uses Seq internally.
newtype BWT a
BWT :: Seq (Maybe a) -> BWT a
-- | The BWTMatrix data type. Uses a Array internally.
newtype BWTMatrix a
BWTMatrix :: Seq (Seq (Maybe a)) -> BWTMatrix a
-- | Computes the Burrows-Wheeler Transform (BWT) using the suffix array
-- and the original string (represented as a Seq for performance).
saToBWT :: SuffixArray a -> Seq a -> Seq (Maybe a)
-- | Computes the corresponding SuffixArray of a given string.
-- Please see suffix array for more information.
createSuffixArray :: Ord a => Seq a -> SuffixArray a
-- | Hierarchical sorting scheme that compares fst first then snd.
-- Necessary for the setting up the BWT in order to correctly invert it
-- using the Magic algorithm.
sortTB :: (Ord a1, Ord a2) => (a1, a2) -> (a1, a2) -> Ordering
-- | Abstract BWTSeq type utilizing a Seq.
type BWTSeq a = Seq a
-- | Abstract data type representing a BWTSeq in the (strict) ST monad.
type STBWTSeq s a = STRef s (BWTSeq a)
-- | State function to push BWTString data into stack.
pushSTBWTSeq :: STBWTSeq s a -> a -> ST s ()
-- | State function to create empty STBWTString type.
emptySTBWTSeq :: ST s (STBWTSeq s a)
-- | Abstract BWTCounter and associated state type.
type STBWTCounter s a = STRef s Int
-- | State function to update BWTCounter.
updateSTBWTCounter :: STBWTCounter s Int -> Int -> ST s ()
-- | State function to create empty STBWTCounter type.
emptySTBWTCounter :: ST s (STBWTCounter s Int)
-- | Magic Inverse BWT function.
magicInverseBWT :: Seq (Maybe a, Int) -> ST s (BWTSeq a)
-- | Simple yet efficient implementation of converting a given string into
-- a BWT Matrix (the BWTMatrix type is a Seq (Maybe a).
createBWTMatrix :: Ord a => [a] -> BWTMatrix a
instance GHC.Generics.Generic (Data.BWT.Internal.Suffix a)
instance GHC.Read.Read a => GHC.Read.Read (Data.BWT.Internal.Suffix a)
instance GHC.Show.Show a => GHC.Show.Show (Data.BWT.Internal.Suffix a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.BWT.Internal.Suffix a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.BWT.Internal.Suffix a)
instance GHC.Generics.Generic (Data.BWT.Internal.BWT a)
instance GHC.Read.Read a => GHC.Read.Read (Data.BWT.Internal.BWT a)
instance GHC.Show.Show a => GHC.Show.Show (Data.BWT.Internal.BWT a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.BWT.Internal.BWT a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.BWT.Internal.BWT a)
instance GHC.Generics.Generic (Data.BWT.Internal.BWTMatrix a)
instance GHC.Read.Read a => GHC.Read.Read (Data.BWT.Internal.BWTMatrix a)
instance GHC.Show.Show a => GHC.Show.Show (Data.BWT.Internal.BWTMatrix a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.BWT.Internal.BWTMatrix a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.BWT.Internal.BWTMatrix a)
-- | Burrows-Wheeler Transform (BWT)
--
-- The two functions that most users will utilize are toBWT and
-- fromBWT. There are auxilary function(s) inside of
-- Data.BWT.Internal.
--
-- The helper functions for ByteString, bytestringToBWT,
-- bytestringFromWord8BWT, bytestringFromByteStringBWT and
-- Text, textToBWT and textFromBWT should help for common
-- use cases.
--
-- Data.BWT.Internal also has the function
-- createBWTMatrix, which can be useful as well, although not used
-- by either toBWT or fromBWT.
module Data.BWT
-- | Takes a String and returns the Burrows-Wheeler Transform (BWT).
-- Implemented via a SuffixArray.
toBWT :: Ord a => [a] -> BWT a
-- | Helper function for converting a ByteString to a BWT
-- Word8.
bytestringToBWT :: ByteString -> BWT Word8
-- | A newtype to ensure you only uncompress a BWT created from
-- textToBWT, since [Word8] -> Text is partial.
newtype TextBWT
TextBWT :: BWT Word8 -> TextBWT
-- | Helper function for converting Text to a TextBWT.
textToBWT :: Text -> TextBWT
-- | Takes a BWT data type (please see Data.BWT.Internal)
-- and inverts it back to the original string.
--
-- This function utilizes the state monad (strict) in order to implement
-- the Magic Inverse BWT algorithm by backtracking indices
-- starting with the (Nothing,_) entry.
fromBWT :: Ord a => BWT a -> [a]
-- | Helper function for converting a BWT of Word8s to a
-- ByteString.
bytestringFromWord8BWT :: BWT Word8 -> ByteString
-- | Helper function for converting a BWT ByteStrings to a
-- ByteString.
bytestringFromByteStringBWT :: BWT ByteString -> ByteString
-- | Helper function for converting TextBWT to a Text
textFromBWT :: TextBWT -> Text
instance GHC.Generics.Generic Data.BWT.TextBWT
instance GHC.Read.Read Data.BWT.TextBWT
instance GHC.Show.Show Data.BWT.TextBWT
instance GHC.Classes.Ord Data.BWT.TextBWT
instance GHC.Classes.Eq Data.BWT.TextBWT
-- | 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
-- Move-to-front transform (MTF) and the Inverse MTF implementations,
-- namely seqToMTFB, seqToMTFT, seqFromMTFB, and
-- seqFromMTFT.
--
-- The MTF implementations rely heavily upon Seq provided by the
-- containers, STRef and associated functions in the
-- stref library, and runST in the Control.Monad.ST
-- library.
module Data.MTF.Internal
-- | Basic MTF (ByteString) data type.
newtype MTFB
MTFB :: (Seq Int, Seq (Maybe ByteString)) -> MTFB
-- | Basic MTF (Text) data type.
newtype MTFT
MTFT :: (Seq Int, Seq (Maybe Text)) -> MTFT
-- | Useful to acquire the unique elements that make up a Seq.
-- Credit to @DavidFletcher. See this stackoverflow post.
nubSeq' :: Ord a => Seq (Maybe a) -> Seq (Maybe a)
-- | Abstract PBMTFSeqB type utilizing a Seq
type PBMTFSeqB = Seq (Maybe ByteString)
-- | Abstract MTFLSSeqB type utilizing a Seq.
type MTFLSSeqB = (Seq Int, Seq (Maybe ByteString))
-- | Abstract data type representing a MTFLSSeqB in the (strict) ST
-- monad.
type STMTFLSSeqB s a = STRef s MTFLSSeqB
-- | Abstract data type to initialize a STMTFLSSeqB using the
-- initial list.
initializeSTMTFLSSeqB :: STMTFLSSeqB s (Seq Int, Seq (Maybe ByteString)) -> Seq (Maybe ByteString) -> ST s ()
-- | State function to update MTFLSSeqB with each step of the MTF.
updateSTMTFLSSeqB :: STMTFLSSeqB s (Seq Int, Seq (Maybe ByteString)) -> Int -> ST s ()
-- | State function to create empty STMTFLSSeqB type.
emptySTMTFLSSeqB :: ST s (STMTFLSSeqB s a)
-- | Abstract STMTFILB and associated state type.
type STMTFILB s a = STRef s (Seq (Maybe ByteString))
-- | State function to load list into STMTFILB.
loadSTMTFILB :: STMTFILB s (Maybe ByteString) -> Seq (Maybe ByteString) -> ST s ()
-- | State function to create empty STMTFILB type.
emptySTMTFILB :: ST s (STMTFILB s a)
-- | Abstract STMTFCounterB and associated state type.
type STMTFCounterB s a = STRef s Int
-- | State function to update STMTFCounterB.
updateSTMTFCounterB :: STMTFCounterB s Int -> Int -> ST s ()
-- | State function to create empty STMTFCounterB type.
emptySTMTFCounterB :: ST s (STMTFCounterB s Int)
-- | Strict state monad function.
seqToMTFB :: PBMTFSeqB -> ST s MTFLSSeqB
-- | Abstract PTMTFSeqT type utilizing a Seq
type PTMTFSeqT = Seq (Maybe Text)
-- | Abstract MTFLSSeqT type utilizing a Seq.
type MTFLSSeqT = (Seq Int, Seq (Maybe Text))
-- | Abstract data type representing a MTFLSSeqT in the (strict) ST
-- monad.
type STMTFLSSeqT s a = STRef s MTFLSSeqT
-- | Abstract data type to initialize a STMTFLSSeqT using the
-- initial list.
initializeSTMTFLSSeqT :: STMTFLSSeqT s (Seq Int, Seq (Maybe Text)) -> Seq (Maybe Text) -> ST s ()
-- | State function to update STMTFLSSeqT with each step of the MTF.
updateSTMTFLSSeqT :: STMTFLSSeqT s (Seq Int, Seq (Maybe Text)) -> Int -> ST s ()
-- | State function to create empty STMTFLSSeqT type.
emptySTMTFLSSeqT :: ST s (STMTFLSSeqT s a)
-- | Abstract STMTFILT and associated state type.
type STMTFILT s a = STRef s (Seq (Maybe Text))
-- | State function to load list into STMTFILT.
loadSTMTFILT :: STMTFILT s (Maybe Text) -> Seq (Maybe Text) -> ST s ()
-- | State function to create empty STMTFILT type.
emptySTMTFILT :: ST s (STMTFILT s a)
-- | Abstract STMTFCounterT and associated state type.
type STMTFCounterT s a = STRef s Int
-- | State function to update STMTFCounterT.
updateSTMTFCounterT :: STMTFCounterT s Int -> Int -> ST s ()
-- | State function to create empty STMTFCounterT type.
emptySTMTFCounterT :: ST s (STMTFCounterT s Int)
-- | Strict state monad function.
seqToMTFT :: PTMTFSeqT -> ST s MTFLSSeqT
-- | Abstract FMTFSeqB type utilizing a Seq.
type FMTFSeqB = Seq (Maybe ByteString)
-- | Abstract data type representing a FMTFSeqB in the (strict) ST
-- monad.
type FSTMTFSeqB s a = STRef s FMTFSeqB
-- | State function to update FSTMTFSeqB with each step of the
-- inverse MTF.
updateFSTMTFSeqB :: FSTMTFSeqB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
-- | State function to create empty FSTMTFSeqB type.
emptyFSTMTFSeqB :: ST s (FSTMTFSeqB s a)
-- | Abstract FSTMTFILB and associated state type.
type FSTMTFILB s a = STRef s (Seq (Maybe ByteString))
-- | State function to load list into FSTMTFILB.
loadFSTMTFILB :: FSTMTFILB s (Maybe ByteString) -> Seq (Maybe ByteString) -> ST s ()
-- | State function to update FSTMTFILB.
updateFSTMTFILB :: FSTMTFILB s (Maybe ByteString) -> Int -> ST s ()
-- | State function to create empty FSTMTFILB type.
emptyFSTMTFILB :: ST s (FSTMTFILB s a)
-- | Strict state monad function.
seqFromMTFB :: MTFB -> ST s FMTFSeqB
-- | Abstract FMTFSeqT type utilizing a Seq.
type FMTFSeqT = Seq (Maybe Text)
-- | Abstract data type representing a FMTFSeqT in the (strict) ST
-- monad.
type FSTMTFSeqT s a = STRef s FMTFSeqT
-- | State function to update FSTMTFSeqT with each step of the
-- inverse MTF.
updateFSTMTFSeqT :: FSTMTFSeqT s (Maybe Text) -> Maybe Text -> ST s ()
-- | State function to create empty FSTMTFSeqT type.
emptyFSTMTFSeqT :: ST s (FSTMTFSeqT s a)
-- | Abstract FSTMTFILT and associated state type.
type FSTMTFILT s a = STRef s (Seq (Maybe Text))
-- | State function to load list into FSTMTFILT.
loadFSTMTFILT :: FSTMTFILT s (Maybe Text) -> Seq (Maybe Text) -> ST s ()
-- | State function to update FSTMTFILT.
updateFSTMTFILT :: FSTMTFILT s (Maybe Text) -> Int -> ST s ()
-- | State function to create empty FSTMTFILT type.
emptyFSTMTFILT :: ST s (FSTMTFILT s a)
-- | Strict state monad function.
seqFromMTFT :: MTFT -> ST s FMTFSeqT
instance GHC.Generics.Generic Data.MTF.Internal.MTFB
instance GHC.Read.Read Data.MTF.Internal.MTFB
instance GHC.Show.Show Data.MTF.Internal.MTFB
instance GHC.Classes.Ord Data.MTF.Internal.MTFB
instance GHC.Classes.Eq Data.MTF.Internal.MTFB
instance GHC.Generics.Generic Data.MTF.Internal.MTFT
instance GHC.Read.Read Data.MTF.Internal.MTFT
instance GHC.Show.Show Data.MTF.Internal.MTFT
instance GHC.Classes.Ord Data.MTF.Internal.MTFT
instance GHC.Classes.Eq Data.MTF.Internal.MTFT
-- | Move-to-front transform (MTF)
--
-- Users will get the most mileage by first compressing to a BWT
-- on the initial ByteString or Text input before
-- compressing to a MTFB or MTFT.
--
-- To do this, users can use the bytestringToBWTToMTFB and
-- bytestringToBWTToMTFT functions, as well as the
-- textToBWTToMTFB and textToBWTToMTFT functions.
--
-- The base functions for ByteString, bytestringToMTFB and
-- bytestringToMTFT can be used to convert a Seq
-- (Maybe ByteString) to a MTFB and MTFT,
-- respectively.
--
-- Likewise, the base functions for Text, textToMTFB and
-- textToMTFT can be used to convert a Seq (Maybe
-- Text) to a MTFB and MTFT respectively.
--
-- There are various other lower-level functions for interacting with the
-- MTF implementation on ByteString and Text as well.
--
-- Data.MTF.Internal contains efficient and stateful
-- implementations of the MTF and Inverse MTF algorithms.
module Data.MTF
-- | Helper function for converting a ByteString to a MTFB
-- via a BWT first.
bytestringToBWTToMTFB :: ByteString -> MTFB
-- | Helper function for converting a ByteString to a MTFT
-- via a BWT first.
bytestringToBWTToMTFT :: ByteString -> MTFT
-- | Helper function for converting a Text to a MTFB via a
-- BWT first.
textToBWTToMTFB :: Text -> MTFB
-- | Helper function for converting a Text to a MTFT via a
-- BWT first.
textToBWTToMTFT :: Text -> MTFT
-- | Take a BWT of Word8s and generate the Move-to-front
-- transform (MTFB).
textBWTToMTFB :: TextBWT -> MTFB
-- | Take a BWT of Word8s and generate the Move-to-front
-- transform (MTFB).
bytestringBWTToMTFB :: BWT Word8 -> MTFB
-- | Take a BWT of Word8s and generate the Move-to-front
-- transform (MTFB).
textBWTToMTFT :: TextBWT -> MTFT
-- | Take a BWT of Word8s and generate the Move-to-front
-- transform (MTFT).
bytestringBWTToMTFT :: BWT Word8 -> MTFT
-- | Takes a Text and returns the Move-to-front transform
-- (MTFB).
textToMTFB :: Seq (Maybe Text) -> MTFB
-- | Takes a Seq of ByteStrings and returns the Move-to-front
-- transform (MTFB).
bytestringToMTFB :: Seq (Maybe ByteString) -> MTFB
-- | Takes a Text and returns the Move-to-front transform
-- (MTFT).
textToMTFT :: Seq (Maybe Text) -> MTFT
-- | Takes a ByteString and returns the Move-to-front transform
-- (MTFT).
bytestringToMTFT :: Seq (Maybe ByteString) -> MTFT
-- | Helper function for converting a BWTed MTFB back to the
-- original ByteString.
bytestringFromBWTFromMTFB :: MTFB -> ByteString
-- | Helper function for converting a BWTed MTFT back to the
-- original ByteString.
bytestringFromBWTFromMTFT :: MTFT -> ByteString
-- | Helper function for converting a BWTed MTFB back to the
-- original Text.
textFromBWTFromMTFB :: MTFB -> Text
-- | Helper function for converting a BWTed MTFT back to the
-- original Text.
textFromBWTFromMTFT :: MTFT -> Text
-- | Takes a MTFT and returns the BWT of Texts.
textBWTFromMTFT :: MTFT -> BWT Text
-- | Takes a MTFT and returns the BWT of ByteStrings.
bytestringBWTFromMTFT :: MTFT -> BWT ByteString
-- | Takes a MTFB and returns the BWT of Texts.
textBWTFromMTFB :: MTFB -> BWT Text
-- | Take a MTFB and returns the BWT of ByteStrings.
bytestringBWTFromMTFB :: MTFB -> BWT ByteString
-- | Takes a MTFB and returns the original Seq of
-- Texts.
textFromMTFB :: MTFB -> Seq (Maybe Text)
-- | Takes a MTFB and returns the original Seq of
-- ByteStrings.
bytestringFromMTFB :: MTFB -> Seq (Maybe ByteString)
-- | Takes a MTFT and returns the original Seq of
-- Texts.
textFromMTFT :: MTFT -> Seq (Maybe Text)
-- | Takes a MTFT and returns the original Seq of
-- ByteStrings.
bytestringFromMTFT :: MTFT -> Seq (Maybe ByteString)
-- | 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
-- Full-text Minute-space index (FM-index) and the Inverse
-- FM-index implementations, namely seqToOccCKB,
-- seqToOccCKT, seqToCcB, seqToCcT,
-- seqFromFMIndexB, and seqFromFMIndexT.
--
-- The FM-index implementations rely heavily upon Seq provided by
-- the containers library, STRef and associated functions
-- in the stref library, and runST in the
-- Control.Monad.ST library.
--
-- Example FM-index Output
--
-- The below example is taken from this wikipedia page.
--
-- Given the following input, "abracadabra"
--
-- and
--
-- the following Burrows-Wheeler matrix (BWM) of the input "abracadabra":
--
-- TODO: table
--
-- The FM-index output of the Burrows-Wheeler transform of the input is:
--
-- C[c] of "ard$rcaaaabb"
--
-- TODO: table
--
-- and
--
-- Occ(c,k) of "ard$rcaaaabb"
--
-- TODO: table
--
-- Keep in mind that the $ is translated into a Nothing.
module Data.FMIndex.Internal
-- | Basic FMIndex (ByteString) data type.
newtype FMIndexB
FMIndexB :: (CcB, OccCKB) -> FMIndexB
-- | Basic FMIndex (Text) data type.
newtype FMIndexT
FMIndexT :: (CcT, OccCKT) -> FMIndexT
-- | Basic OccCKB (ByteString) data type.
newtype OccCKB
OccCKB :: Seq (Maybe ByteString, Seq (Int, Int, Maybe ByteString)) -> OccCKB
-- | Basic OccCKT (Text) data type.
newtype OccCKT
OccCKT :: Seq (Maybe Text, Seq (Int, Int, Maybe Text)) -> OccCKT
-- | Basic C[c] table (ByteString) data type.
newtype CcB
CcB :: Seq (Int, Maybe ByteString) -> CcB
-- | Basic C[c] table (Text) data type.
newtype CcT
CcT :: Seq (Int, Maybe Text) -> CcT
-- | Basic count (ByteString) operation data type.
newtype CB
CB :: Maybe Int -> CB
-- | Basic count (Text) operation data type.
newtype CT
CT :: Maybe Int -> CT
-- | Abstract PBOccCKSeqB type utilizing a Seq.
type PBOccCKSeqB = Seq (Maybe ByteString)
-- | Abstract OccCKSeqB type utilizing a Seq.
-- (c,(indexofinputcurrentelement,Occ(c,k),inputcurrentelement))
type OccCKSeqB = Seq (Maybe ByteString, Seq (Int, Int, Maybe ByteString))
-- | Abstract data type representing a OccCKSeqB in the (strict) ST
-- monad.
type STOccCKSeqB s a = STRef s OccCKSeqB
-- | State function to update OccCKSeqB with each step of the OccCK.
updateSTOccCKSeqAB :: STOccCKSeqB s (Seq (Maybe ByteString, Seq (Int, Int, Maybe ByteString))) -> (Int, Int, Maybe ByteString) -> ST s ()
-- | State function to update OccCKSeqB with each step of the OccCK.
updateSTOccCKSeqBB :: STOccCKSeqB s (Seq (Maybe ByteString, Seq (Int, Int, Maybe ByteString))) -> Maybe ByteString -> ST s ()
-- | State function to create empty STOccCKSeqB type.
emptySTOccCKSeqB :: ST s (STOccCKSeqB s a)
-- | Abstract STOccCKILB and associated state type.
type STOccCKILB s a = STRef s (Seq (Maybe ByteString))
-- | State function to load list into STOccCKILB.
loadSTOccCKILB :: STOccCKILB s (Maybe ByteString) -> Seq (Maybe ByteString) -> ST s ()
-- | State function to create empty STOccCKILB type.
emptySTOccCKILB :: ST s (STOccCKILB s a)
-- | Abstract STOccCKCounterB and associated state type.
type STOccCKCounterB s a = STRef s Int
-- | State function to update STOccCKCounterB.
updateSTOccCKCounterB :: STOccCKCounterB s Int -> Int -> ST s ()
-- | State function to create empty STOccCKCounterB type.
emptySTOccCKCounterB :: ST s (STOccCKCounterB s Int)
-- | Strict state monad function.
seqToOccCKB :: PBOccCKSeqB -> ST s OccCKSeqB
-- | Abstract PTOccCKSeqT type utilizing a Seq.
type PTOccCKSeqT = Seq (Maybe Text)
-- | Abstract OccCKSeqT type utilizing a Seq.
-- (c,(indexofinputcurrentelement,Occ(c,k),inputcurrentelement))
type OccCKSeqT = Seq (Maybe Text, Seq (Int, Int, Maybe Text))
-- | Abstract data type representing a OccCKSeqT in the (strict) ST
-- monad.
type STOccCKSeqT s a = STRef s OccCKSeqT
-- | State function to update OccCKSeqT with each step of the OccCK.
updateSTOccCKSeqAT :: STOccCKSeqT s (Seq (Maybe Text, Seq (Int, Int, Maybe Text))) -> (Int, Int, Maybe Text) -> ST s ()
-- | State function to update OccCKSeqT with each step of the OccCK.
updateSTOccCKSeqBT :: STOccCKSeqT s (Seq (Maybe Text, Seq (Int, Int, Maybe Text))) -> Maybe Text -> ST s ()
-- | State function to create empty STOccCKSeqT type.
emptySTOccCKSeqT :: ST s (STOccCKSeqT s a)
-- | Abstract STOccCKILT and associated state type.
type STOccCKILT s a = STRef s (Seq (Maybe Text))
-- | State function to load list into STOccCKILT.
loadSTOccCKILT :: STOccCKILT s (Maybe Text) -> Seq (Maybe Text) -> ST s ()
-- | State function to create empty STOccCKILT type.
emptySTOccCKILT :: ST s (STOccCKILT s a)
-- | Abstract STOccCKCounterT and associated state type.
type STOccCKCounterT s a = STRef s Int
-- | State function to update STOccCKCounterT.
updateSTOccCKCounterT :: STOccCKCounterT s Int -> Int -> ST s ()
-- | State function to create empty STOccCKCounterT type.
emptySTOccCKCounterT :: ST s (STOccCKCounterT s Int)
-- | Strict state monad function.
seqToOccCKT :: PTOccCKSeqT -> ST s OccCKSeqT
-- | Abstract PBCcSeqB type utilizing a Seq.
type PBCcSeqB = Seq (Maybe ByteString)
-- | Abstract CcSeqB type utilizing a Seq. (C[c],c)
type CcSeqB = Seq (Int, Maybe ByteString)
-- | Abstract data type representing a CcSeqB in the (strict) ST
-- monad.
type STCcSeqB s a = STRef s CcSeqB
-- | State function to update CcSeqB with each step of the C[c].
updateSTCcSeqB :: STCcSeqB s (Seq (Int, Maybe ByteString)) -> (Int, Maybe ByteString) -> ST s ()
-- | State function to create empty STCcSeqT type.
emptySTCcSeqB :: ST s (STCcSeqB s a)
-- | Abstract STCcILB and associated state type.
type STCcILB s a = STRef s (Seq (Maybe ByteString))
-- | State function to load list into STCcILB.
loadSTCcILB :: STCcILB s (Maybe ByteString) -> Seq (Maybe ByteString) -> ST s ()
-- | State function to create empty STCcILB type.
emptySTCcILB :: ST s (STCcILB s a)
-- | Abstract STCcCounterB and associated state type.
type STCcCounterB s a = STRef s Int
-- | State function to update STCcCounterB.
updateSTCcCounterB :: STCcCounterB s Int -> Int -> ST s ()
-- | State function to create empty STCcCounterT type.
emptySTCcCounterB :: ST s (STCcCounterB s Int)
-- | Strict state monad function.
seqToCcB :: PBCcSeqB -> ST s CcSeqB
-- | Abstract PTCcSeqT type utilizing a Seq.
type PTCcSeqT = Seq (Maybe Text)
-- | Abstract CcSeqT type utilizing a Seq. (C[c],c)
type CcSeqT = Seq (Int, Maybe Text)
-- | Abstract data type representing a CcSeqT in the (strict) ST
-- monad.
type STCcSeqT s a = STRef s CcSeqT
-- | State function to update CcSeqT with each step of the C[c].
updateSTCcSeqT :: STCcSeqT s (Seq (Int, Maybe Text)) -> (Int, Maybe Text) -> ST s ()
-- | State function to create empty STCcSeqT type.
emptySTCcSeqT :: ST s (STCcSeqT s a)
-- | Abstract STCcILT and associated state type.
type STCcILT s a = STRef s (Seq (Maybe Text))
-- | State function to load list into STCcILT.
loadSTCcILT :: STCcILT s (Maybe Text) -> Seq (Maybe Text) -> ST s ()
-- | State function to create empty STCcILT type.
emptySTCcILT :: ST s (STCcILT s a)
-- | Abstract STCcCounterT and associated state type.
type STCcCounterT s a = STRef s Int
-- | State function to update STCcCounterT.
updateSTCcCounterT :: STCcCounterT s Int -> Int -> ST s ()
-- | State function to create empty STCcCounterT type.
emptySTCcCounterT :: ST s (STCcCounterT s Int)
-- | Strict state monad function.
seqToCcT :: PTCcSeqT -> ST s CcSeqT
-- | Abstract FFMIndexSeqB type utilizing a Seq.
type FFMIndexSeqB = Seq (Maybe ByteString)
-- | Simple Inverse FMIndex function.
seqFromFMIndexB :: FMIndexB -> FFMIndexSeqB
-- | Abstract FFMIndexSeqT type utilizing a Seq.
type FFMIndexSeqT = Seq (Maybe Text)
-- | Simple Inverse FMIndex function.
seqFromFMIndexT :: FMIndexT -> FFMIndexSeqT
-- | Abstract PBCPat type utilizing a Seq.
type PBCPat = Seq ByteString
-- | Abstract CIntB type utilizing an Int.
type CIntB = Maybe Int
-- | Abstract STCBoolB type utilizing a Bool.
type STCBoolB s a = STRef s Bool
-- | State function to update STCBoolB in the (strict) ST monad.
updateSTCBoolB :: STCBoolB s Bool -> Bool -> ST s ()
-- | State function to create empty STCBoolB type.
emptySTCBoolB :: ST s (STCBoolB s Bool)
-- | Abstract data type representing a STCCounterB in the (strict)
-- ST monad.
type STCCounterB s a = STRef s Int
-- | State function to update STCCounterB
updateSTCCounterB :: STCCounterB s Int -> Int -> ST s ()
-- | State function to create empty STCCounterB type.
emptySTCCounterB :: ST s (STCCounterB s Int)
-- | Abstract STCCurrentStartB type utilizing a Seq.
type STCCurrentStartB s a = STRef s Int
-- | State function to update STCCurrentStartB.
updateSTCCurrentStartB :: STCCurrentStartB s Int -> Int -> ST s ()
-- | State function to create empty STCCurrentStartB type.
emptySTCCurrentStartB :: ST s (STCCurrentStartB s Int)
-- | Abstract STCCurrentEndB type utilizing a Seq.
type STCCurrentEndB s a = STRef s Int
-- | State function to update STCCurrentEndB.
updateSTCCurrentEndB :: STCCurrentEndB s Int -> Int -> ST s ()
-- | State function to create empty STCCurrentEndB type.
emptySTCCurrentEndB :: ST s (STCCurrentEndB s Int)
-- | Count operation on a FMIndexB. This operation takes a pattern
-- (Seq ByteString) and returns the number of occurences of
-- that pattern in the original text T credit.
countFMIndexB :: PBCPat -> FMIndexB -> ST s CIntB
-- | Abstract PTCPat type utilizing a Seq.
type PTCPat = Seq Text
-- | Abstract CIntT type utilizing an Int.
type CIntT = Maybe Int
-- | Abstract STCBoolT type utilizing a Bool.
type STCBoolT s a = STRef s Bool
-- | State function to update STCBoolT in the (strict) ST monad.
updateSTCBoolT :: STCBoolT s Bool -> Bool -> ST s ()
-- | State function to create empty STCBoolT type.
emptySTCBoolT :: ST s (STCBoolT s Bool)
-- | Abstract data type representing a STCCounterT in the (strict)
-- ST monad.
type STCCounterT s a = STRef s Int
-- | State function to update STCCounterT
updateSTCCounterT :: STCCounterT s Int -> Int -> ST s ()
-- | State function to create empty STCCounterT type.
emptySTCCounterT :: ST s (STCCounterT s Int)
-- | Abstract STCCurrentStartT type utilizing a Seq.
type STCCurrentStartT s a = STRef s Int
-- | State function to update STCCurrentStartT.
updateSTCCurrentStartT :: STCCurrentStartT s Int -> Int -> ST s ()
-- | State function to create empty STCCurrentStartT type.
emptySTCCurrentStartT :: ST s (STCCurrentStartT s Int)
-- | Abstract STCCurrentEndT type utilizing a Seq.
type STCCurrentEndT s a = STRef s Int
-- | State function to update STCCurrentEndT.
updateSTCCurrentEndT :: STCCurrentEndT s Int -> Int -> ST s ()
-- | State function to create empty STCCurrentEndT type.
emptySTCCurrentEndT :: ST s (STCCurrentEndT s Int)
-- | Count operation on a FMIndexT. This operation takes a pattern
-- (Seq Text) and returns the number of occurences of that
-- pattern in the original text T credit.
countFMIndexT :: PTCPat -> FMIndexT -> ST s CIntT
-- | Abstract PBLPat type utilizing a Seq.
type PBLPat = Seq ByteString
-- | Abstract LIntB type utilizing an Int.
type LIntB = Seq (Maybe Int)
-- | Abstract STLBoolB type utilizing a Bool.
type STLBoolB s a = STRef s Bool
-- | State function to update STLBoolB in the (strict) ST monad.
updateSTLBoolB :: STLBoolB s Bool -> Bool -> ST s ()
-- | State function to create empty STLBoolB type.
emptySTLBoolB :: ST s (STLBoolB s Bool)
-- | Abstract data type representing a STLCounterB in the (strict)
-- ST monad.
type STLCounterB s a = STRef s Int
-- | State function to update STLCounterB
updateSTLCounterB :: STLCounterB s Int -> Int -> ST s ()
-- | State function to create empty STLCounterB type.
emptySTLCounterB :: ST s (STLCounterB s Int)
-- | Abstract STLCurrentStartB type utilizing a Seq.
type STLCurrentStartB s a = STRef s Int
-- | State function to update STLCurrentStartB.
updateSTLCurrentStartB :: STLCurrentStartB s Int -> Int -> ST s ()
-- | State function to create empty STLCurrentStartB type.
emptySTLCurrentStartB :: ST s (STLCurrentStartB s Int)
-- | Abstract STLCurrentEndB type utilizing a Seq.
type STLCurrentEndB s a = STRef s Int
-- | State function to update STLCurrentEndB.
updateSTLCurrentEndB :: STLCurrentEndB s Int -> Int -> ST s ()
-- | State function to create empty STLCurrentEndB type.
emptySTLCurrentEndB :: ST s (STCCurrentEndB s Int)
-- | Locate operation on a FMIndexB. This operation takes a pattern
-- (Seq ByteString) and returns the indexe(s) of occurences
-- of that pattern in the original text T credit.
locateFMIndexB :: PBLPat -> FMIndexB -> ST s LIntB
-- | Abstract PTLPat type utilizing a Seq.
type PTLPat = Seq Text
-- | Abstract LIntT type utilizing an Int.
type LIntT = Seq (Maybe Int)
-- | Abstract STLBoolT type utilizing a Bool.
type STLBoolT s a = STRef s Bool
-- | State function to update STLBoolT in the (strict) ST monad.
updateSTLBoolT :: STLBoolT s Bool -> Bool -> ST s ()
-- | State function to create empty STLBoolT type.
emptySTLBoolT :: ST s (STLBoolT s Bool)
-- | Abstract data type representing a STLCounterT in the (strict)
-- ST monad.
type STLCounterT s a = STRef s Int
-- | State function to update STLCounterT
updateSTLCounterT :: STLCounterT s Int -> Int -> ST s ()
-- | State function to create empty STLCounterT type.
emptySTLCounterT :: ST s (STLCounterT s Int)
-- | Abstract STLCurrentStartT type utilizing a Seq.
type STLCurrentStartT s a = STRef s Int
-- | State function to update STLCurrentStartT.
updateSTLCurrentStartT :: STLCurrentStartT s Int -> Int -> ST s ()
-- | State function to create empty STLCurrentStartT type.
emptySTLCurrentStartT :: ST s (STLCurrentStartT s Int)
-- | Abstract STLCurrentEndT type utilizing a Seq.
type STLCurrentEndT s a = STRef s Int
-- | State function to update STLCurrentEndT.
updateSTLCurrentEndT :: STLCurrentEndT s Int -> Int -> ST s ()
-- | State function to create empty STLCurrentEndT type.
emptySTLCurrentEndT :: ST s (STLCurrentEndT s Int)
-- | Locate operation on a FMIndexT. This operation takes a pattern
-- (Seq Text) and returns the indexe(s) of occurences of
-- that pattern in the original text T credit.
locateFMIndexT :: PTLPat -> FMIndexT -> ST s LIntT
instance GHC.Generics.Generic Data.FMIndex.Internal.OccCKB
instance GHC.Read.Read Data.FMIndex.Internal.OccCKB
instance GHC.Show.Show Data.FMIndex.Internal.OccCKB
instance GHC.Classes.Ord Data.FMIndex.Internal.OccCKB
instance GHC.Classes.Eq Data.FMIndex.Internal.OccCKB
instance GHC.Generics.Generic Data.FMIndex.Internal.OccCKT
instance GHC.Read.Read Data.FMIndex.Internal.OccCKT
instance GHC.Show.Show Data.FMIndex.Internal.OccCKT
instance GHC.Classes.Ord Data.FMIndex.Internal.OccCKT
instance GHC.Classes.Eq Data.FMIndex.Internal.OccCKT
instance GHC.Generics.Generic Data.FMIndex.Internal.CcB
instance GHC.Read.Read Data.FMIndex.Internal.CcB
instance GHC.Show.Show Data.FMIndex.Internal.CcB
instance GHC.Classes.Ord Data.FMIndex.Internal.CcB
instance GHC.Classes.Eq Data.FMIndex.Internal.CcB
instance GHC.Generics.Generic Data.FMIndex.Internal.FMIndexB
instance GHC.Read.Read Data.FMIndex.Internal.FMIndexB
instance GHC.Show.Show Data.FMIndex.Internal.FMIndexB
instance GHC.Classes.Ord Data.FMIndex.Internal.FMIndexB
instance GHC.Classes.Eq Data.FMIndex.Internal.FMIndexB
instance GHC.Generics.Generic Data.FMIndex.Internal.CcT
instance GHC.Read.Read Data.FMIndex.Internal.CcT
instance GHC.Show.Show Data.FMIndex.Internal.CcT
instance GHC.Classes.Ord Data.FMIndex.Internal.CcT
instance GHC.Classes.Eq Data.FMIndex.Internal.CcT
instance GHC.Generics.Generic Data.FMIndex.Internal.FMIndexT
instance GHC.Read.Read Data.FMIndex.Internal.FMIndexT
instance GHC.Show.Show Data.FMIndex.Internal.FMIndexT
instance GHC.Classes.Ord Data.FMIndex.Internal.FMIndexT
instance GHC.Classes.Eq Data.FMIndex.Internal.FMIndexT
instance GHC.Generics.Generic Data.FMIndex.Internal.CB
instance GHC.Read.Read Data.FMIndex.Internal.CB
instance GHC.Show.Show Data.FMIndex.Internal.CB
instance GHC.Classes.Ord Data.FMIndex.Internal.CB
instance GHC.Classes.Eq Data.FMIndex.Internal.CB
instance GHC.Generics.Generic Data.FMIndex.Internal.CT
instance GHC.Read.Read Data.FMIndex.Internal.CT
instance GHC.Show.Show Data.FMIndex.Internal.CT
instance GHC.Classes.Ord Data.FMIndex.Internal.CT
instance GHC.Classes.Eq Data.FMIndex.Internal.CT
-- | Full-text Minute-space index (FM-index)
--
-- Users will get the most mileage by first compressing to a BWT
-- on the initial ByteString or Text input before
-- compressing to a FMIndexB or FMIndexT.
--
-- To do this, users can use the bytestringToBWTToFMIndexB and
-- bytestringToBWTToFMIndexT functions, as well as the
-- textToBWTToFMIndexB and textToBWTToFMIndexT functions.
--
-- The base functions for ByteString, bytestringToFMIndexB
-- and bytestringToFMIndexT can be used to convert a Seq
-- (Maybe ByteString) to a FMIndexB and
-- FMIndexT, respectively.
--
-- Likewise, the base functions for Text, textToFMIndexB
-- and textToFMIndexT can be used to convert a Seq
-- (Maybe Text) to a FMIndexB and FMIndexT
-- respectively.
--
-- There are various other lower-level functions for interacting with the
-- FMIndex implementation on ByteString and Text as well.
--
-- Operation: Count
--
-- The count operation on ByteString,
-- bytestringFMIndexCount, is implemented using the
-- countFMIndexB function.
--
-- The count operation on Text, textFMIndexCount, is
-- implemented using the countFMIndexT function.
--
-- Operation: Locate
--
-- The locate operation on ByteString,
-- bytestringFMIndexLocate, is implemented using the
-- locateFMIndexB function.
--
-- The locate operation on Text, textFMIndexLocate, is
-- implemented using the locateFMIndexT function.
--
-- Internal
--
-- Data.FMIndex.Internal contains efficient and stateful
-- implementations of the FMIndex and Inverse FMIndex algorithms.
module Data.FMIndex
-- | Helper function for converting a ByteString to a
-- FMIndexB via a BWT first.
bytestringToBWTToFMIndexB :: ByteString -> FMIndexB
-- | Helper function for converting a ByteString to a
-- FMIndexT via a BWT first.
bytestringToBWTToFMIndexT :: ByteString -> FMIndexT
-- | Helper function for converting a Text to a FMIndexB via
-- a BWT first.
textToBWTToFMIndexB :: Text -> FMIndexB
-- | Helper function for converting a Text to a FMIndexT via
-- a BWT first.
textToBWTToFMIndexT :: Text -> FMIndexT
-- | Take a BWT of Word8s and generate the FM-index
-- (FMIndexB).
textBWTToFMIndexB :: BWTMatrix Word8 -> TextBWT -> FMIndexB
-- | Take a BWT of Word8s and generate the FM-index
-- (FMIndexB).
bytestringBWTToFMIndexB :: BWTMatrix Word8 -> BWT Word8 -> FMIndexB
-- | Take a BWT of Word8s and generate the FM-index
-- (FMIndexB).
textBWTToFMIndexT :: BWTMatrix Word8 -> TextBWT -> FMIndexT
-- | Take a BWT of Word8s and generate the FM-index
-- (FMIndexT).
bytestringBWTToFMIndexT :: BWTMatrix Word8 -> BWT Word8 -> FMIndexT
-- | Takes a Text and returns the FM-index (FMIndexB).
textToFMIndexB :: BWTMatrix Text -> Seq (Maybe Text) -> FMIndexB
-- | Takes a Seq of ByteStrings and returns the FM-index
-- (FMIndexB).
bytestringToFMIndexB :: BWTMatrix ByteString -> Seq (Maybe ByteString) -> FMIndexB
-- | Takes a Text and returns the FM-index (FMIndexT).
textToFMIndexT :: BWTMatrix Text -> Seq (Maybe Text) -> FMIndexT
-- | Takes a ByteString and returns the FM-index (FMIndexT).
bytestringToFMIndexT :: BWTMatrix ByteString -> Seq (Maybe ByteString) -> FMIndexT
-- | Helper function for converting a BWTed FMIndexB back to
-- the original ByteString.
bytestringFromBWTFromFMIndexB :: FMIndexB -> ByteString
-- | Helper function for converting a BWTed FMIndexT back to
-- the original ByteString.
bytestringFromBWTFromFMIndexT :: FMIndexT -> ByteString
-- | Helper function for converting a BWTed FMIndexB back to
-- the original Text.
textFromBWTFromFMIndexB :: FMIndexB -> Text
-- | Helper function for converting a BWTed FMIndexT back to
-- the original Text.
textFromBWTFromFMIndexT :: FMIndexT -> Text
-- | Takes a FMIndexT and returns the BWT of Texts.
textBWTFromFMIndexT :: FMIndexT -> BWT Text
-- | Takes a FMIndexT and returns the BWT of
-- ByteStrings.
bytestringBWTFromFMIndexT :: FMIndexT -> BWT ByteString
-- | Takes a FMIndexB and returns the BWT of Texts.
textBWTFromFMIndexB :: FMIndexB -> BWT Text
-- | Take a FMIndexB and returns the BWT of
-- ByteStrings.
bytestringBWTFromFMIndexB :: FMIndexB -> BWT ByteString
-- | Takes a FMIndexB and returns the original Seq of
-- Texts.
textFromFMIndexB :: FMIndexB -> Seq (Maybe Text)
-- | Takes a FMIndexB and returns the original Seq of
-- ByteStrings.
bytestringFromFMIndexB :: FMIndexB -> Seq (Maybe ByteString)
-- | Takes a FMIndexT and returns the original Seq of
-- Texts.
textFromFMIndexT :: FMIndexT -> Seq (Maybe Text)
-- | Takes a FMIndexT and returns the original Seq of
-- ByteStrings.
bytestringFromFMIndexT :: FMIndexT -> Seq (Maybe ByteString)
-- | Takes a list of pattern(s) of ByteStrings and an input
-- ByteString and returns the number of occurences of the
-- pattern(s) in the input ByteString.
bytestringFMIndexCount :: [ByteString] -> ByteString -> Seq (ByteString, CIntB)
-- | Takes a list of pattern(s) of Texts and an input Text
-- and returns the number of occurences of the pattern(s) in the input
-- Text.
textFMIndexCount :: [Text] -> Text -> Seq (Text, CIntT)
-- | Takes a list of pattern(s) of ByteStrings and an input
-- ByteString and returns the indexe(s) of occurences of the
-- pattern(s) in the input ByteString. The output indices are
-- 1-based, and are not sorted.
bytestringFMIndexLocate :: [ByteString] -> ByteString -> Seq (ByteString, LIntB)
-- | Takes a list of pattern(s) of Texts and an input Text
-- and returns the indexe(s) of occurences of the pattern(s) in the input
-- Text. The output indices are 1-based, and are not
-- sorted.
textFMIndexLocate :: [Text] -> Text -> Seq (Text, LIntT)
-- | 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
-- seqToRLEB, seqToRLET, seqFromRLEB, and
-- seqFromRLET.
--
-- The RLE implementations rely heavily upon Seq provided by the
-- containers, STRef and associated functions in the
-- stref library, and runST in the Control.Monad.ST
-- library.
module Data.RLE.Internal
-- | Basic RLE (ByteString) data type.
newtype RLEB
RLEB :: Seq (Maybe ByteString) -> RLEB
-- | Basic RLE (Text) data type.
newtype RLET
RLET :: Seq (Maybe Text) -> RLET
-- | Abstract RLESeqB type utilizing a Seq.
type RLESeqB = Seq (Maybe ByteString)
-- | Abstract data type representing a RLESeqB in the (strict) ST
-- monad.
type STRLESeqB s a = STRef s RLESeqB
-- | State function to push RLESeqB data into stack.
pushSTRLESeqB :: STRLESeqB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
-- | State function to create empty STRLESeqB type.
emptySTRLESeqB :: ST s (STRLESeqB s a)
-- | Abstract STRLETempB and associated state type.
type STRLETempB s a = STRef s (Maybe ByteString)
-- | State function to update STRLETempB.
updateSTRLETempB :: STRLETempB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
-- | State function to create empty STRLETempB type.
emptySTRLETempB :: ST s (STRLETempB s a)
-- | Abstract STRLECounterB state type.
type STRLECounterB s a = STRef s Int
-- | State function to update STRLECounterB.
updateSTRLECounterB :: STRLECounterB s Int -> Int -> ST s ()
-- | State function to create empty STRLECounterB type.
emptySTRLECounterB :: ST s (STRLECounterB s Int)
-- | Strict state monad function.
seqToRLEB :: RLESeqB -> ST s RLESeqB
-- | Abstract RLESeqT type utilizing a Seq.
type RLESeqT = Seq (Maybe Text)
-- | Abstract data type representing a RLESeqT in the (strict) ST
-- monad.
type STRLESeqT s a = STRef s RLESeqT
-- | State function to push RLESeqT data into stack.
pushSTRLESeqT :: STRLESeqT s (Maybe Text) -> Maybe Text -> ST s ()
-- | State function to create empty STRLESeqT type.
emptySTRLESeqT :: ST s (STRLESeqT s a)
-- | Abstract STRLETempT state type.
type STRLETempT s a = STRef s (Maybe Text)
-- | State function to update STRLETempT.
updateSTRLETempT :: STRLETempT s (Maybe Text) -> Maybe Text -> ST s ()
-- | State function to create empty STRLETempT type.
emptySTRLETempT :: ST s (STRLETempT s a)
-- | Abstract STRLECounterT and associated state type.
type STRLECounterT s a = STRef s Int
-- | State function to update STRLECounterT.
updateSTRLECounterT :: STRLECounterT s Int -> Int -> ST s ()
-- | State function to create empty STRLECounterT type.
emptySTRLECounterT :: ST s (STRLECounterT s Int)
-- | Strict state monad function.
seqToRLET :: RLESeqT -> ST s RLESeqT
-- | Abstract FRLESeqB type utilizing a Seq.
type FRLESeqB = Seq (Maybe ByteString)
-- | Abstract data type representing a FRLESeqB in the (strict) ST
-- monad.
type FSTRLESeqB s a = STRef s FRLESeqB
-- | State function to push FRLESeqB data into stack.
pushFSTRLESeqB :: FSTRLESeqB s (Maybe ByteString) -> Maybe ByteString -> ST s ()
-- | State function to create empty FSTRLESeqB type.
emptyFSTRLESeqB :: ST s (FSTRLESeqB s a)
-- | Strict state monad function.
seqFromRLEB :: RLEB -> ST s FRLESeqB
-- | Abstract FRLESeqT type utilizing a Seq.
type FRLESeqT = Seq (Maybe Text)
-- | Abstract data type representing a FRLESeqT in the (strict) ST
-- monad.
type FSTRLESeqT s a = STRef s FRLESeqT
-- | State function to push FSTRLESeqT data into stack.
pushFSTRLESeqT :: FSTRLESeqT s (Maybe Text) -> Maybe Text -> ST s ()
-- | State function to create empty FSTRLESeqT type.
emptyFSTRLESeqT :: ST s (FSTRLESeqT s a)
-- | Strict state monad function.
seqFromRLET :: RLET -> ST s FRLESeqT
instance GHC.Generics.Generic Data.RLE.Internal.RLEB
instance GHC.Read.Read Data.RLE.Internal.RLEB
instance GHC.Show.Show Data.RLE.Internal.RLEB
instance GHC.Classes.Ord Data.RLE.Internal.RLEB
instance GHC.Classes.Eq Data.RLE.Internal.RLEB
instance GHC.Generics.Generic Data.RLE.Internal.RLET
instance GHC.Read.Read Data.RLE.Internal.RLET
instance GHC.Show.Show Data.RLE.Internal.RLET
instance GHC.Classes.Ord Data.RLE.Internal.RLET
instance GHC.Classes.Eq Data.RLE.Internal.RLET
-- | Run-length encoding (RLE)
--
-- Users will get the most mileage by first compressing to a BWT
-- on the initial ByteString or Text input before
-- compressing to a RLEB or RLET.
--
-- To do this, users can use the bytestringToBWTToRLEB and
-- bytestringToBWTToRLET functions, as well as the
-- textToBWTToRLEB and textToBWTToRLET functions.
--
-- The base functions for ByteString, bytestringToRLEB and
-- bytestringToRLET can be used to convert a Seq
-- (Maybe ByteString) to a RLEB and RLET,
-- respectively.
--
-- Likewise, the base functions for Text, textToRLEB and
-- textToRLET can be used to convert a Seq (Maybe
-- Text) to a RLEB and RLET respectively.
--
-- There are various other lower-level functions for interacting with the
-- RLE implementation on ByteString and Text as well.
--
-- Data.RLE.Internal contains efficient and stateful
-- implementations of the RLE and Inverse RLE algorithms.
module Data.RLE
-- | Helper function for converting a ByteString to a RLEB
-- via a BWT first.
bytestringToBWTToRLEB :: ByteString -> RLEB
-- | Helper function for converting a ByteString to a RLET
-- via a BWT first.
bytestringToBWTToRLET :: ByteString -> RLET
-- | Helper function for converting a Text to a RLEB via a
-- BWT first.
textToBWTToRLEB :: Text -> RLEB
-- | Helper function for converting a Text to a RLET via a
-- BWT first.
textToBWTToRLET :: Text -> RLET
-- | Take a BWT of Word8s and generate the Run-length
-- encoding (RLEB).
textBWTToRLEB :: TextBWT -> RLEB
-- | Take a BWT of Word8s and generate the Run-length
-- encoding (RLEB).
bytestringBWTToRLEB :: BWT Word8 -> RLEB
-- | Take a BWT of Word8s and generate the Run-length
-- encoding (RLEB).
textBWTToRLET :: TextBWT -> RLET
-- | Take a BWT of Word8s and generate the Run-length
-- encoding (RLET).
bytestringBWTToRLET :: BWT Word8 -> RLET
-- | Takes a Text and returns the Run-length encoding (RLEB).
textToRLEB :: Seq (Maybe Text) -> RLEB
-- | Takes a Seq of ByteStrings and returns the Run-length
-- encoding (RLEB).
bytestringToRLEB :: Seq (Maybe ByteString) -> RLEB
-- | Takes a Text and returns the Run-length encoding (RLE).
textToRLET :: Seq (Maybe Text) -> RLET
-- | Takes a ByteString and returns the Run-length encoding (RLE).
bytestringToRLET :: Seq (Maybe ByteString) -> RLET
-- | Helper function for converting a BWTed RLEB back to the
-- original ByteString.
bytestringFromBWTFromRLEB :: RLEB -> ByteString
-- | Helper function for converting a BWTed RLET back to the
-- original ByteString.
bytestringFromBWTFromRLET :: RLET -> ByteString
-- | Helper function for converting a BWTed RLEB back to the
-- original Text.
textFromBWTFromRLEB :: RLEB -> Text
-- | Helper function for converting a BWTed RLET back to the
-- original Text.
textFromBWTFromRLET :: RLET -> Text
-- | Takes a RLET and returns the BWT of Texts.
textBWTFromRLET :: RLET -> BWT Text
-- | Takes a RLET and returns the BWT of ByteStrings.
bytestringBWTFromRLET :: RLET -> BWT ByteString
-- | Takes a RLEB and returns the BWT of Texts.
textBWTFromRLEB :: RLEB -> BWT Text
-- | Take a RLEB and returns the BWT of ByteStrings.
bytestringBWTFromRLEB :: RLEB -> BWT ByteString
-- | Takes a RLEB and returns the original Seq of
-- Texts.
textFromRLEB :: RLEB -> Seq (Maybe Text)
-- | Takes a RLEB and returns the original Seq of
-- ByteStrings.
bytestringFromRLEB :: RLEB -> Seq (Maybe ByteString)
-- | Takes a RLET and returns the original Seq of
-- Texts.
textFromRLET :: RLET -> Seq (Maybe Text)
-- | Takes a RLET and returns the original Seq of
-- ByteStrings.
bytestringFromRLET :: RLET -> Seq (Maybe ByteString)