@@ -56,6 +56,8 @@ module Codec.Compression.Zlib.Stream (
5656 defaultStrategy ,
5757 filteredStrategy ,
5858 huffmanOnlyStrategy ,
59+ rleStrategy ,
60+ fixedStrategy ,
5961
6062 -- * The buisness
6163 deflate ,
@@ -586,14 +588,14 @@ data Flush =
586588 | SyncFlush
587589 | FullFlush
588590 | Finish
589- -- | Block -- only available in zlib 1.2 and later, uncomment if you need it.
591+ | Block
590592
591593fromFlush :: Flush -> CInt
592594fromFlush NoFlush = # {const Z_NO_FLUSH }
593595fromFlush SyncFlush = # {const Z_SYNC_FLUSH }
594596fromFlush FullFlush = # {const Z_FULL_FLUSH }
595597fromFlush Finish = # {const Z_FINISH }
596- -- fromFlush Block = #{const Z_BLOCK}
598+ fromFlush Block = # {const Z_BLOCK }
597599
598600
599601-- | The format used for compression or decompression. There are three
@@ -855,25 +857,21 @@ data CompressionStrategy =
855857 DefaultStrategy
856858 | Filtered
857859 | HuffmanOnly
860+ | RLE
861+ -- ^ @since 0.7.0.0
862+ | Fixed
863+ -- ^ @since 0.7.0.0
858864 deriving (Eq , Ord , Enum , Bounded , Show , Typeable
859865#if __GLASGOW_HASKELL__ >= 702
860866 , Generic
861867#endif
862868 )
863869
864- {-
865- -- -- only available in zlib 1.2 and later, uncomment if you need it.
866- | RLE -- ^ Use 'RLE' to limit match distances to one (run-length
867- -- encoding). 'RLE' is designed to be almost as fast as
868- -- 'HuffmanOnly', but give better compression for PNG
869- -- image data.
870- | Fixed -- ^ 'Fixed' prevents the use of dynamic Huffman codes,
871- -- allowing for a simpler decoder for special applications.
872- -}
873-
874870{-# DEPRECATED DefaultStrategy "Use defaultStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
875871{-# DEPRECATED Filtered "Use filteredStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
876872{-# DEPRECATED HuffmanOnly "Use huffmanOnlyStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
873+ {-# DEPRECATED RLE "Use rleStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
874+ {-# DEPRECATED Fixed "Use fixedStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
877875
878876-- | Use this default compression strategy for normal data.
879877--
@@ -896,14 +894,28 @@ filteredStrategy = Filtered
896894huffmanOnlyStrategy :: CompressionStrategy
897895huffmanOnlyStrategy = HuffmanOnly
898896
897+ -- | Use 'rleStrategy' to limit match distances to one (run-length
898+ -- encoding). 'rleStrategy' is designed to be almost as fast as
899+ -- 'huffmanOnlyStrategy', but give better compression for PNG
900+ -- image data.
901+ --
902+ -- @since 0.7.0.0
903+ rleStrategy :: CompressionStrategy
904+ rleStrategy = RLE
905+
906+ -- | 'fixedStrategy' prevents the use of dynamic Huffman codes,
907+ -- allowing for a simpler decoder for special applications.
908+ --
909+ -- @since 0.7.0.0
910+ fixedStrategy :: CompressionStrategy
911+ fixedStrategy = Fixed
899912
900913fromCompressionStrategy :: CompressionStrategy -> CInt
901914fromCompressionStrategy DefaultStrategy = # {const Z_DEFAULT_STRATEGY }
902915fromCompressionStrategy Filtered = # {const Z_FILTERED }
903916fromCompressionStrategy HuffmanOnly = # {const Z_HUFFMAN_ONLY }
904- -- fromCompressionStrategy RLE = #{const Z_RLE}
905- -- fromCompressionStrategy Fixed = #{const Z_FIXED}
906-
917+ fromCompressionStrategy RLE = # {const Z_RLE }
918+ fromCompressionStrategy Fixed = # {const Z_FIXED }
907919
908920withStreamPtr :: (Ptr StreamState -> IO a ) -> Stream a
909921withStreamPtr f = do
0 commit comments