Skip to content

Commit

Permalink
Make quickcheck-classes dependency optional
Browse files Browse the repository at this point in the history
  • Loading branch information
liskin committed Apr 3, 2021
1 parent 05e8c20 commit 031bbd6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
18 changes: 13 additions & 5 deletions tests/Properties/Stack.hs
@@ -1,19 +1,23 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Properties.Stack where

import Test.QuickCheck
import Test.QuickCheck.Classes (
Laws (lawsTypeclass, lawsProperties), Proxy1 (Proxy1),
foldableLaws, traversableLaws,
)
import Instances

import XMonad.StackSet hiding (filter)
import qualified XMonad.StackSet as S (filter)

import Data.Maybe

#ifdef VERSION_quickcheck_classes
import Test.QuickCheck.Classes (
Laws (lawsTypeclass, lawsProperties), Proxy1 (Proxy1),
foldableLaws, traversableLaws,
)
import Data.Functor.Classes (Eq1 (liftEq), Show1 (liftShowsPrec))
#endif


-- The list returned by index should be the same length as the actual
Expand Down Expand Up @@ -57,6 +61,7 @@ prop_differentiate xs =
where _ = xs :: [Int]


#ifdef VERSION_quickcheck_classes
-- Check type class laws of 'Data.Foldable.Foldable' and 'Data.Traversable.Traversable'.
newtype TestStack a = TestStack (Stack a)
deriving (Eq, Read, Show, Foldable, Functor)
Expand Down Expand Up @@ -102,3 +107,6 @@ prop_laws_Stack =
(\(name, prop) ->
("Stack: " <> lawsTypeclass laws <> ": " <> name, prop))
(lawsProperties laws)
#else
prop_laws_Stack = []
#endif
7 changes: 6 additions & 1 deletion xmonad.cabal
Expand Up @@ -61,6 +61,8 @@ flag generatemanpage
manual: True
description: Build the tool for generating the man page

flag quickcheck-classes

library
exposed-modules: XMonad
XMonad.Config
Expand Down Expand Up @@ -137,10 +139,13 @@ test-suite properties
hs-source-dirs: tests
build-depends: base
, QuickCheck >= 2
, quickcheck-classes >= 0.4.3
, X11
, containers
, xmonad

if flag(quickcheck-classes)
-- no quickcheck-classes in LTS-12
build-depends: quickcheck-classes >= 0.4.3

if flag(pedantic)
ghc-options: -Werror

0 comments on commit 031bbd6

Please sign in to comment.