Fix building with QuickCheck older than 2.9.0

This commit is contained in:
mrkkrp 2016-10-06 22:37:40 +03:00
parent 0367967161
commit e6c5c2beed
2 changed files with 15 additions and 4 deletions

View File

@ -175,15 +175,20 @@ 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)
(NE.fromList . getNonEmpty <$> arbitrary)
#if MIN_VERSION_QuickCheck(2,9,0)
<$> arbitrary
#else
arbitrary
<$> (NE.fromList . getNonEmpty <$> arbitrary)
#endif
#if MIN_VERSION_QuickCheck(2,8,2)
<*> arbitrary
<*> arbitrary
<*> arbitrary
#else
<*> (E.fromList <$> arbitrary)
<*> (E.fromList <$> arbitrary)
<*> (E.fromList <$> arbitrary)
#endif
-- | Merge two error data structures into one joining their collections of
-- message items and preferring longest match. In other words, earlier error

View File

@ -72,6 +72,12 @@ import qualified Data.Set as E
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
#if !MIN_VERSION_QuickCheck(2,8,2)
instance (Arbitrary a, Ord a) => Arbitrary (E.Set a) where
arbitrary = E.fromList <$> arbitrary
shrink = fmap E.fromList . shrink . E.toList
#endif
spec :: Spec
spec = do