Skip to content

Commit

Permalink
Import Arbitrary NonEmpty from quickcheck-instances
Browse files Browse the repository at this point in the history
It was added in QuickCheck-2.9 and dropped in QuickCheck-2.10.
  • Loading branch information
spl committed Jul 4, 2017
1 parent b2f791a commit 5b41d0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dlist.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ test-suite test
base,
Cabal,
QuickCheck < 2.11
if impl(ghc >= 8)
-- QuickCheck-2.9 introduced support for Semigroup and NonEmpty in base.
-- It is required for testing base >= 4.9 (GHC >= 8).
build-depends: QuickCheck >= 2.9
-- Semigroup and NonEmpty were introduced in base-4.9 (ghc-8).
-- QuickCheck-2.9 included support. QuickCheck-2.10 dropped support.
-- quickcheck-instances-0.3.15 has the Arbitrary NonEmpty instance.
if impl(ghc > 8)
build-depends: QuickCheck >= 2.9,
quickcheck-instances >= 0.3.15 && < 0.4
else
build-depends: QuickCheck >= 2.7
8 changes: 8 additions & 0 deletions tests/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ import Data.DList
import OverloadedStrings (testOverloadedStrings)

#if MIN_VERSION_base(4,9,0)
-- base-4.9 introduced Semigroup and NonEmpty.
import Data.Semigroup (Semigroup(..))
import Data.List.NonEmpty (NonEmpty(..))

-- QuickCheck-2.10 dropped the Arbitrary NonEmpty instance, so we import it from
-- quickcheck-instances.
#if MIN_VERSION_QuickCheck(2,10,0)
import Test.QuickCheck.Instances ()
#endif

#endif

--------------------------------------------------------------------------------
Expand Down

0 comments on commit 5b41d0d

Please sign in to comment.