The Haskell "zlib" library wraps the C library and lazily decompresses. The "decompress" function in this library can throw exceptions only catchable in the IO monad.
The type is this:
decompress :: ByteString -> ByteString
It uses the following:
foldDecompressStream L.Chunk L.Empty
(\_code msg -> error ("Codec.Compression.Zlib: " ++ msg))
Obviously it's possible for a data stream to be corrupted, which will cause an exception to be generated.
If I need to be catching multiple exceptions due to different causes, how can I tell one exception from another, other than by trying to match on the text (which has all sorts of negatives) ? I need to recover intelligently.
The way the code looks you can't do any better than match the string. You need to change something, maybe use foldDecopressionStream yourself?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With