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:
parent
ba6b396a97
commit
2b52dbe905
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
- License: BSD-2-clause
|
- License: BSD-2-clause
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
{-# LANGUAGE TypeSynonymInstances #-}
|
{-# LANGUAGE TypeSynonymInstances #-}
|
||||||
|
|
||||||
|
@ -42,9 +43,11 @@ instance Arbitrary FileID where
|
||||||
instance Arbitrary FileOffset where
|
instance Arbitrary FileOffset where
|
||||||
arbitrary = nonNegative arbitrarySizedIntegral
|
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
|
instance Arbitrary l => Arbitrary (NonEmpty l) where
|
||||||
arbitrary = (:|) <$> arbitrary <*> arbitrary
|
arbitrary = (:|) <$> arbitrary <*> arbitrary
|
||||||
|
#endif
|
||||||
|
|
||||||
nonNegative :: (Num a, Ord a) => Gen a -> Gen a
|
nonNegative :: (Num a, Ord a) => Gen a -> Gen a
|
||||||
nonNegative g = g `suchThat` (>= 0)
|
nonNegative g = g `suchThat` (>= 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue