-- 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.7 -- |

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 sequence provided by the -- containers. -- -- The internal BWTMatrix data type relies upon the massiv -- package. 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 sequence internally. type SuffixArray a = Seq (Suffix a) -- | The BWT data type. Uses sequence internally. type BWT a = Seq (Maybe a) -- | The BWTMatrix data type. Uses a massiv array internally. type BWTMatrix = Array BN Ix1 String -- | Computes the Burrows-Wheeler Transform (BWT) using the suffix array -- and the original string (represented as a sequence for performance). saToBWT :: SuffixArray a -> Seq a -> BWT 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 sequence. 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 massiv array). createBWTMatrix :: String -> BWTMatrix instance GHC.Generics.Generic (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.Read.Read a => GHC.Read.Read (Data.BWT.Internal.Suffix a) instance GHC.Show.Show a => GHC.Show.Show (Data.BWT.Internal.Suffix 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 -- 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 sequence. 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 sequence. 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 sequence. 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 sequence. 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)

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)