@@ -56,6 +56,8 @@ module Codec.Compression.Zlib.Stream (
56
56
defaultStrategy ,
57
57
filteredStrategy ,
58
58
huffmanOnlyStrategy ,
59
+ rleStrategy ,
60
+ fixedStrategy ,
59
61
60
62
-- * The buisness
61
63
deflate ,
@@ -586,14 +588,14 @@ data Flush =
586
588
| SyncFlush
587
589
| FullFlush
588
590
| Finish
589
- -- | Block -- only available in zlib 1.2 and later, uncomment if you need it.
591
+ | Block
590
592
591
593
fromFlush :: Flush -> CInt
592
594
fromFlush NoFlush = # {const Z_NO_FLUSH }
593
595
fromFlush SyncFlush = # {const Z_SYNC_FLUSH }
594
596
fromFlush FullFlush = # {const Z_FULL_FLUSH }
595
597
fromFlush Finish = # {const Z_FINISH }
596
- -- fromFlush Block = #{const Z_BLOCK}
598
+ fromFlush Block = # {const Z_BLOCK }
597
599
598
600
599
601
-- | The format used for compression or decompression. There are three
@@ -855,25 +857,21 @@ data CompressionStrategy =
855
857
DefaultStrategy
856
858
| Filtered
857
859
| HuffmanOnly
860
+ | RLE
861
+ -- ^ @since 0.7.0.0
862
+ | Fixed
863
+ -- ^ @since 0.7.0.0
858
864
deriving (Eq , Ord , Enum , Bounded , Show , Typeable
859
865
#if __GLASGOW_HASKELL__ >= 702
860
866
, Generic
861
867
#endif
862
868
)
863
869
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
-
874
870
{-# DEPRECATED DefaultStrategy "Use defaultStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
875
871
{-# DEPRECATED Filtered "Use filteredStrategy. CompressionStrategy constructors will be hidden in version 0.7" #-}
876
872
{-# 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" #-}
877
875
878
876
-- | Use this default compression strategy for normal data.
879
877
--
@@ -896,14 +894,28 @@ filteredStrategy = Filtered
896
894
huffmanOnlyStrategy :: CompressionStrategy
897
895
huffmanOnlyStrategy = HuffmanOnly
898
896
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
899
912
900
913
fromCompressionStrategy :: CompressionStrategy -> CInt
901
914
fromCompressionStrategy DefaultStrategy = # {const Z_DEFAULT_STRATEGY }
902
915
fromCompressionStrategy Filtered = # {const Z_FILTERED }
903
916
fromCompressionStrategy 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 }
907
919
908
920
withStreamPtr :: (Ptr StreamState -> IO a ) -> Stream a
909
921
withStreamPtr f = do
0 commit comments