HMath.Interchange.Compression¶
Module index · Numerical conventions
Description
Optional zlib codecs with an explicit hard decompression budget. No shell process, temporary files, or implicit fallback. A disabled build returns Unsupported. gzip decoding accepts one member and rejects trailing bytes.
On this page¶
| API | Purpose |
|---|---|
| Compression | Wire wrappers around the same DEFLATE coding. |
| RawDeflate | Declaration and type contract below. |
| Zlib | Declaration and type contract below. |
| Gzip | Declaration and type contract below. |
| compressionAvailable | Probe whether the optional native zlib adapter is available, returning IO Bool. |
| compress | Given limits,RawDeflateZlibGzip wrapper,then bytes, compress within a bounded output allocation. |
| decompress | The output length may be smaller than the budget. |
Documentation
Compression
data Compression Source #
Wire wrappers around the same DEFLATE coding.
Constructors
| RawDeflate | |
| Zlib | |
| Gzip |
Instances
| Enum Compression Source # | |
Defined in HMath.Interchange.Compression Methods succ :: Compression -> Compression # pred :: Compression -> Compression # toEnum :: Int -> Compression # fromEnum :: Compression -> Int # enumFrom :: Compression -> [Compression] # enumFromThen :: Compression -> Compression -> [Compression] # enumFromTo :: Compression -> Compression -> [Compression] # enumFromThenTo :: Compression -> Compression -> Compression -> [Compression] # | |
| Show Compression Source # | |
Defined in HMath.Interchange.Compression Methods showsPrec :: Int -> Compression -> ShowS # show :: Compression -> String # showList :: [Compression] -> ShowS # | |
| Eq Compression Source # | |
Defined in HMath.Interchange.Compression | |
compressionAvailable
compressionAvailable :: IO Bool Source #
Probe whether the optional native zlib adapter is available, returning IO Bool. False means compressed operations cannot run; no payload is processed.
compress
compress :: Limits -> Compression -> ByteString -> IO (Either InterchangeError ByteString) Source #
Given limits,RawDeflateZlibGzip wrapper,then bytes, compress within a bounded output allocation. Return InterchangeError for unavailable provider, invalid limits, byte-budget excess or compression failure in IO.
decompress
decompress :: Limits -> Compression -> Int -> ByteString -> IO (Either InterchangeError ByteString) Source #
The output length may be smaller than the budget. Archives additionally compare it to the declared member size before accepting their payload.