fix build with older QuickCheck

The NonEmpty instance was moved out of QuickCheck and into a package
with more deps than I want to drag in, so I'm providing my own instance,
but with older QuickCheck, use theirs to avoid overlapping.
This commit is contained in:
Joey Hess 2019-03-22 10:07:16 -04:00
parent ba6b396a97
commit 2b52dbe905
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -5,6 +5,7 @@
- License: BSD-2-clause
-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE TypeSynonymInstances #-}
@ -42,9 +43,11 @@ instance Arbitrary FileID where
instance Arbitrary FileOffset where
arbitrary = nonNegative arbitrarySizedIntegral
{- Quickcheck lacks this instance. -}
{- Latest Quickcheck lacks this instance. -}
#if MIN_VERSION_QuickCheck(2,10,0)
instance Arbitrary l => Arbitrary (NonEmpty l) where
arbitrary = (:|) <$> arbitrary <*> arbitrary
#endif
nonNegative :: (Num a, Ord a) => Gen a -> Gen a
nonNegative g = g `suchThat` (>= 0)