Skip to content

Commit da628c1

Browse files
committed
Add missing instances for standard classes
1 parent 85a5734 commit da628c1

File tree

2 files changed

+51
-13
lines changed

2 files changed

+51
-13
lines changed

Codec/Compression/Zlib/Internal.hs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE CPP, RankNTypes, DeriveDataTypeable, BangPatterns #-}
1+
{-# LANGUAGE CPP, RankNTypes, DeriveDataTypeable, DeriveGeneric, BangPatterns #-}
22
#if __GLASGOW_HASKELL__ >= 702
33
{-# LANGUAGE Trustworthy #-}
44
#endif
@@ -86,6 +86,9 @@ import qualified Control.Monad.ST.Unsafe as Unsafe (unsafeIOToST)
8686
import qualified Control.Monad.ST.Strict as Unsafe (unsafeIOToST)
8787
#endif
8888
import Data.Typeable (Typeable)
89+
#if __GLASGOW_HASKELL__ >= 702
90+
import GHC.Generics (Generic)
91+
#endif
8992
import qualified Data.ByteString.Lazy as L
9093
import qualified Data.ByteString.Lazy.Internal as L
9194
import qualified Data.ByteString as S
@@ -115,7 +118,15 @@ data CompressParams = CompressParams {
115118
compressStrategy :: !Stream.CompressionStrategy,
116119
compressBufferSize :: !Int,
117120
compressDictionary :: Maybe S.ByteString
118-
} deriving Show
121+
} deriving
122+
( Eq -- ^ @since 0.7.0.0
123+
, Ord -- ^ @since 0.7.0.0
124+
, Show
125+
, Typeable -- ^ @since 0.7.0.0
126+
#if __GLASGOW_HASKELL__ >= 702
127+
, Generic -- ^ @since 0.7.0.0
128+
#endif
129+
)
119130

120131
-- | The full set of parameters for decompression. The defaults are
121132
-- 'defaultDecompressParams'.
@@ -141,7 +152,15 @@ data DecompressParams = DecompressParams {
141152
decompressBufferSize :: !Int,
142153
decompressDictionary :: Maybe S.ByteString,
143154
decompressAllMembers :: Bool
144-
} deriving Show
155+
} deriving
156+
( Eq -- ^ @since 0.7.0.0
157+
, Ord -- ^ @since 0.7.0.0
158+
, Show
159+
, Typeable -- ^ @since 0.7.0.0
160+
#if __GLASGOW_HASKELL__ >= 702
161+
, Generic -- ^ @since 0.7.0.0
162+
#endif
163+
)
145164

146165
-- | The default set of parameters for compression. This is typically used with
147166
-- 'Codec.Compression.GZip.compressWith' or 'Codec.Compression.Zlib.compressWith'
@@ -236,7 +255,14 @@ data DecompressError =
236255
-- wrong then you will get all the decompressed data but this error at the
237256
-- end, instead of the normal successful 'Stream.StreamEnd'.
238257
| DataFormatError String
239-
deriving (Eq, Typeable)
258+
deriving
259+
( Eq
260+
, Ord -- ^ @since 0.7.0.0
261+
, Typeable
262+
#if __GLASGOW_HASKELL__ >= 702
263+
, Generic -- ^ @since 0.7.0.0
264+
#endif
265+
)
240266

241267
instance Show DecompressError where
242268
show TruncatedInput = modprefix "premature end of compressed data stream"

Codec/Compression/Zlib/Stream.hsc

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,15 @@ data CompressionLevel =
680680
| BestCompression
681681
| CompressionLevel Int
682682
-- ^ Use 'compressionLevel'. 'CompressionLevel' constructors will be hidden in version 0.7.
683-
deriving (Eq, Show, Typeable
683+
deriving
684+
( Eq
685+
, Ord -- ^ @since 0.7.0.0
686+
, Show
687+
, Typeable
684688
#if __GLASGOW_HASKELL__ >= 702
685-
, Generic
689+
, Generic
686690
#endif
687-
)
691+
)
688692

689693
{-# DEPRECATED DefaultCompression "Use 'defaultCompression'. 'CompressionLevel' constructors will be hidden in version 0.7." #-}
690694
{-# DEPRECATED NoCompression "Use 'noCompression'. 'CompressionLevel' constructors will be hidden in version 0.7." #-}
@@ -746,11 +750,15 @@ data WindowBits = WindowBits Int
746750
-- is used by the tests.
747751
-- It makse sense because the default value
748752
-- is is also the max value at 15.
749-
deriving (Eq, Ord, Show, Typeable
753+
deriving
754+
( Eq
755+
, Ord -- ^ @since 0.7.0.0
756+
, Show
757+
, Typeable
750758
#if __GLASGOW_HASKELL__ >= 702
751-
, Generic
759+
, Generic
752760
#endif
753-
)
761+
)
754762

755763
{-# DEPRECATED DefaultWindowBits "Use 'defaultWindowBits'. 'WindowBits' constructors will be hidden in version 0.7." #-}
756764
--FIXME: cannot deprecate constructor named the same as the type
@@ -807,11 +815,15 @@ data MemoryLevel =
807815
| MaxMemoryLevel
808816
| MemoryLevel Int
809817
-- ^ Use 'memoryLevel'. 'MemoryLevel' constructors will be hidden in version 0.7.
810-
deriving (Eq, Show, Typeable
818+
deriving
819+
( Eq
820+
, Ord -- ^ @since 0.7.0.0
821+
, Show
822+
, Typeable
811823
#if __GLASGOW_HASKELL__ >= 702
812-
, Generic
824+
, Generic
813825
#endif
814-
)
826+
)
815827

816828
{-# DEPRECATED DefaultMemoryLevel "Use 'defaultMemoryLevel'. 'MemoryLevel' constructors will be hidden in version 0.7." #-}
817829
{-# DEPRECATED MinMemoryLevel "Use 'minMemoryLevel'. 'MemoryLevel' constructors will be hidden in version 0.7." #-}

0 commit comments

Comments
 (0)