@@ -9,7 +9,7 @@ import Codec.Compression.Zlib.Internal
9
9
import Test.Codec.Compression.Zlib.Stream ()
10
10
import Test.QuickCheck
11
11
12
- import Control.Monad (ap , msum )
12
+ import Control.Monad (ap )
13
13
14
14
15
15
deriving instance Show CompressParams
@@ -20,24 +20,6 @@ instance Arbitrary CompressParams where
20
20
`ap` arbitrary `ap` arbitraryBufferSize
21
21
`ap` return Nothing
22
22
23
- -- this definition (and the equivalent in DecompressParams below) could be
24
- -- made nicer using Data.Accessor, but it's probably not worth the
25
- -- dependency
26
- shrink cp = msum [
27
- return (\ lv -> cp { compressLevel = lv }) `ap`
28
- shrink (compressLevel cp),
29
- return (\ mt -> cp { compressMethod = mt }) `ap`
30
- shrink (compressMethod cp),
31
- return (\ wb -> cp { compressWindowBits = wb }) `ap`
32
- shrink (compressWindowBits cp),
33
- return (\ ml -> cp { compressMemoryLevel = ml }) `ap`
34
- shrink (compressMemoryLevel cp),
35
- return (\ st -> cp { compressStrategy = st }) `ap`
36
- shrink (compressStrategy cp),
37
- return (\ bs -> cp { compressBufferSize = bs }) `ap`
38
- shrink (compressBufferSize cp)
39
- ]
40
-
41
23
arbitraryBufferSize :: Gen Int
42
24
arbitraryBufferSize = frequency $ [(10 , return n) | n <- [1 .. 1024 ]] ++
43
25
[(20 , return n) | n <- [1025 .. 8192 ]] ++
@@ -48,10 +30,7 @@ arbitraryBufferSize = frequency $ [(10, return n) | n <- [1..1024]] ++
48
30
deriving instance Show DecompressParams
49
31
50
32
instance Arbitrary DecompressParams where
51
- arbitrary = return DecompressParams `ap` arbitrary `ap` arbitraryBufferSize `ap` return Nothing
52
- shrink dp = msum [
53
- return (\ wb -> dp { decompressWindowBits = wb }) `ap`
54
- shrink (decompressWindowBits dp),
55
- return (\ bs -> dp { decompressBufferSize = bs }) `ap`
56
- shrink (decompressBufferSize dp)
57
- ]
33
+ arbitrary = return DecompressParams `ap` arbitrary
34
+ `ap` arbitraryBufferSize
35
+ `ap` return Nothing
36
+
0 commit comments