Allow ‘QuickCheck-2.10’

This commit is contained in:
mrkkrp 2017-06-25 20:12:00 +07:00
parent 5a8d8f181a
commit 56ad434eda
4 changed files with 4 additions and 23 deletions

View File

@ -66,14 +66,8 @@ instance NFData t => NFData (ErrorItem t)
instance Arbitrary t => Arbitrary (ErrorItem t) where
arbitrary = oneof
[
#if !MIN_VERSION_QuickCheck(2,9,0)
Tokens <$> (NE.fromList . getNonEmpty <$> arbitrary)
[ Tokens <$> (NE.fromList . getNonEmpty <$> arbitrary)
, Label <$> (NE.fromList . getNonEmpty <$> arbitrary)
#else
Tokens <$> arbitrary
, Label <$> arbitrary
#endif
, return EndOfInput ]
-- | The type class defines how to represent information about various
@ -179,11 +173,7 @@ instance ( Show t
instance (Arbitrary t, Ord t, Arbitrary e, Ord e)
=> Arbitrary (ParseError t e) where
arbitrary = ParseError
#if MIN_VERSION_QuickCheck(2,9,0)
<$> arbitrary
#else
<$> (NE.fromList . getNonEmpty <$> arbitrary)
#endif
#if MIN_VERSION_QuickCheck(2,8,2)
<*> arbitrary
<*> arbitrary

View File

@ -134,12 +134,7 @@ instance NFData s => NFData (State s)
instance Arbitrary a => Arbitrary (State a) where
arbitrary = State
<$> arbitrary
<*>
#if !MIN_VERSION_QuickCheck(2,9,0)
(NE.fromList . getNonEmpty <$> arbitrary)
#else
arbitrary
#endif
<*> (NE.fromList . getNonEmpty <$> arbitrary)
<*> choose (1, 10000)
<*> (unsafePos <$> choose (1, 20))

View File

@ -33,7 +33,7 @@ flag dev
default: False
library
build-depends: QuickCheck >= 2.7 && < 3.0
build-depends: QuickCheck >= 2.7 && < 2.11
, base >= 4.7 && < 5.0
, bytestring >= 0.2 && < 0.11
, containers >= 0.5 && < 0.6
@ -90,7 +90,7 @@ test-suite tests
, Text.Megaparsec.PermSpec
, Text.Megaparsec.PosSpec
, Text.Megaparsec.PrimSpec
build-depends: QuickCheck >= 2.7 && < 3.0
build-depends: QuickCheck >= 2.7 && < 2.11
, base >= 4.7 && < 5.0
, bytestring >= 0.2 && < 0.11
, containers >= 0.5 && < 0.6

View File

@ -1501,11 +1501,7 @@ instance Arbitrary Span where
start <- arbitrary
end <- arbitrary `suchThat` (> start)
Span start end <$>
#if !MIN_VERSION_QuickCheck(2,9,0)
(NE.fromList . getNonEmpty <$> arbitrary)
#else
arbitrary
#endif
instance ShowToken Span where
showTokens ts = concat (NE.toList . spanBody <$> ts)