@@ -1,15 +0,0 @@
1−module Util.Zlib (decompressEither) where
2−
3−-- From http://stackoverflow.com/questions/10043102/how-to-catch-the-decompress-ioerror/10045963#10045963
4−import Codec.Compression.Zlib.Internal
5−import Data.ByteString.Lazy (ByteString, fromChunks)
6−import Control.Arrow (right)
7−
8−decompressEither :: ByteString -> Either (DecompressError, String) ByteString
9−decompressEither = finalise
10− . foldDecompressStream cons nil err
11− . decompressWithErrors zlibFormat defaultDecompressParams
12− where err errorCode errorString = Left (errorCode, errorString)
13− nil = Right []
14− cons chunk = right (chunk :)
15− finalise = right fromChunks