-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | LZMA/XZ compression and decompression
--   
--   This package provides a pure interface for compressing and
--   decompressing LZMA (Lempel–Ziv–Markov chain algorithm) streams
--   of data represented as lazy ByteStrings. A monadic
--   incremental interface is provided as well. This package relies on the
--   liblzma C library.
--   
--   The following packages are based on this package and provide API
--   support for popular streaming frameworks:
--   
--   
--   
- lzma-streams (for io-streams)
--   
- pipes-lzma (for pipes)
--   
- lzma-conduit (for conduit)
--   
@package lzma
@version 0.0.1.1

-- | Compression and decompression of data streams in the lzma/xz format
--   
--   See also the XZ Utils home page: http://tukaani.org/xz/
module Codec.Compression.Lzma

-- | Compress lazy ByteString into .xz format using
--   defaultCompressParams.
compress :: ByteString -> ByteString

-- | Decompress lazy ByteString from the .xz format
decompress :: ByteString -> ByteString

-- | Like compress but with the ability to specify various
--   compression parameters. Typical usage:
--   
--   
--   compressWith defaultCompressParams { compress... = ... }
--   
compressWith :: CompressParams -> ByteString -> ByteString

-- | Like decompress but with the ability to specify various
--   decompression parameters. Typical usage:
--   
--   
--   decompressWith defaultDecompressParams { decompress... = ... }
--   
decompressWith :: DecompressParams -> ByteString -> ByteString
data CompressStream m

-- | Compression process requires input to proceed. You can either flush
--   the stream (first field), supply an input chunk (second field), or
--   signal the end of input (via empty chunk).
CompressInputRequired :: m (CompressStream m) -> (ByteString -> m (CompressStream m)) -> CompressStream m

-- | Output chunk available.
CompressOutputAvailable :: !ByteString -> m (CompressStream m) -> CompressStream m
CompressStreamEnd :: CompressStream m

-- | Incremental compression in the IO monad.
compressIO :: CompressParams -> IO (CompressStream IO)

-- | Incremental compression in the lazy ST monad.
compressST :: CompressParams -> ST s (CompressStream (ST s))
data DecompressStream m

-- | Decoding process requires input to proceed. An empty ByteString
--   chunk signals end of input.
DecompressInputRequired :: (ByteString -> m (DecompressStream m)) -> DecompressStream m

-- | Decompressed output chunk available.
DecompressOutputAvailable :: !ByteString -> m (DecompressStream m) -> DecompressStream m

-- | Decoded stream is finished. Any unconsumed leftovers from the input
--   stream are returned via the ByteString field
DecompressStreamEnd :: ByteString -> DecompressStream m
DecompressStreamError :: !LzmaRet -> DecompressStream m

-- | Incremental decompression in the IO monad.
decompressIO :: DecompressParams -> IO (DecompressStream IO)

-- | Incremental decompression in the lazy ST monad.
decompressST :: DecompressParams -> ST s (DecompressStream (ST s))
data LzmaRet
LzmaRetOK :: LzmaRet
LzmaRetStreamEnd :: LzmaRet
LzmaRetUnsupportedCheck :: LzmaRet
LzmaRetGetCheck :: LzmaRet
LzmaRetMemError :: LzmaRet
LzmaRetMemlimitError :: LzmaRet
LzmaRetFormatError :: LzmaRet
LzmaRetOptionsError :: LzmaRet
LzmaRetDataError :: LzmaRet
LzmaRetBufError :: LzmaRet
LzmaRetProgError :: LzmaRet

-- | The default set of parameters for compression. This is typically used
--   with the compressWith function with specific parameters
--   overridden.
defaultCompressParams :: CompressParams

-- | Set of parameters for compression. The defaults are
--   defaultCompressParams.
data CompressParams

-- | CompressParams field: Specify type of integrity check
compressIntegrityCheck :: CompressParams -> IntegrityCheck

-- | CompressParams field: See documentation of
--   CompressionLevel
compressLevel :: CompressParams -> CompressionLevel

-- | CompressParams field: Enable slower variant of the
--   lzmaCompLevel preset, see xz(1) man-page for
--   details.
compressLevelExtreme :: CompressParams -> Bool

-- | Number of threads to use. It must be greater than zero.
compressThreads :: CompressParams -> Int

-- | Integrity check type (only supported when compressing .xz
--   files)
data IntegrityCheck

-- | disable integrity check (not recommended)
IntegrityCheckNone :: IntegrityCheck

-- | CRC32 using the polynomial from IEEE-802.3
IntegrityCheckCrc32 :: IntegrityCheck

-- | CRC64 using the polynomial from ECMA-182
IntegrityCheckCrc64 :: IntegrityCheck

-- | SHA-256
IntegrityCheckSha256 :: IntegrityCheck

-- | Compression level presets that define the tradeoff between
--   computational complexity and compression ratio
--   
--   CompressionLevel0 has the lowest compression ratio as well as
--   the lowest memory requirements, whereas CompressionLevel9 has
--   the highest compression ratio and can require over 600MiB during
--   compression (and over 60MiB during decompression). The man-page for
--   xz(1) contains more detailed information with tables describing
--   the properties of all compression level presets.
--   
--   CompressionLevel6 is the default setting in
--   defaultCompressParams as it provides a good trade-off and
--   matches the default of the xz(1) tool.
data CompressionLevel
CompressionLevel0 :: CompressionLevel
CompressionLevel1 :: CompressionLevel
CompressionLevel2 :: CompressionLevel
CompressionLevel3 :: CompressionLevel
CompressionLevel4 :: CompressionLevel
CompressionLevel5 :: CompressionLevel
CompressionLevel6 :: CompressionLevel
CompressionLevel7 :: CompressionLevel
CompressionLevel8 :: CompressionLevel
CompressionLevel9 :: CompressionLevel

-- | The default set of parameters for decompression. This is typically
--   used with the decompressWith function with specific
--   parameters overridden.
defaultDecompressParams :: DecompressParams

-- | Set of parameters for decompression. The defaults are
--   defaultDecompressParams.
data DecompressParams

-- | DecompressParams field: If set, abort if decoded stream has no
--   integrity check.
decompressTellNoCheck :: DecompressParams -> Bool

-- | DecompressParams field: If set, abort (via
--   LzmaRetGetCheck) if decoded stream integrity check is
--   unsupported.
decompressTellUnsupportedCheck :: DecompressParams -> Bool

-- | DecompressParams field: If set, abort (via
--   LzmaRetGetCheck) as soon as the type of the integrity check has
--   been detected.
decompressTellAnyCheck :: DecompressParams -> Bool

-- | DecompressParams field: If set, concatenated files as decoded
--   seamless.
decompressConcatenated :: DecompressParams -> Bool

-- | DecompressParams field: If set, legacy .lzma-encoded
--   streams are allowed too.
decompressAutoDecoder :: DecompressParams -> Bool

-- | DecompressParams field: decompressor memory limit. Set to
--   maxBound to disable memory limit.
decompressMemLimit :: DecompressParams -> Word64
