Skip to content

Commit

Permalink
Make quickcheck-classes usage optional (again)
Browse files Browse the repository at this point in the history
quickcheck-classes (actually one of its deps, aeson) conflicts with
template-haskell in GHC 9.10 as of 2024-05-13

This partially reverts commit a16541b.
  • Loading branch information
liskin committed May 13, 2024
1 parent 4361181 commit 22fdeeb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions tests/Properties/Stack.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}

#ifdef VERSION_quickcheck_classes
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
#endif

module Properties.Stack where

Expand All @@ -11,11 +15,13 @@ import qualified XMonad.StackSet as S (filter)

import Data.Maybe

#ifdef VERSION_quickcheck_classes
import Data.Proxy
import Test.QuickCheck.Classes (
Laws (lawsTypeclass, lawsProperties), Proxy1 (Proxy1),
foldableLaws, traversableLaws,
)
#endif


-- The list returned by index should be the same length as the actual
Expand Down Expand Up @@ -59,6 +65,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 All @@ -75,3 +82,6 @@ prop_laws_Stack = format (foldableLaws p) <> format (traversableLaws p)
p = Proxy :: Proxy TestStack
format laws = [ ("Stack: " <> lawsTypeclass laws <> ": " <> name, prop)
| (name, prop) <- lawsProperties laws ]
#else
prop_laws_Stack = []
#endif
7 changes: 6 additions & 1 deletion xmonad.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ flag pedantic
default: False
manual: True

flag quickcheck-classes

library
exposed-modules: XMonad
XMonad.Config
Expand Down Expand Up @@ -123,12 +125,15 @@ test-suite properties
hs-source-dirs: tests
build-depends: base
, QuickCheck >= 2
, quickcheck-classes >= 0.4.3
, X11
, containers
, xmonad
default-language: Haskell2010

if flag(quickcheck-classes)
-- quickcheck-classes or its deps conflict with template-haskell in GHC 9.10 as of 2024-05-13
build-depends: quickcheck-classes >= 0.4.3

if impl(ghc > 9.8)
ghc-options: -Wno-x-partial

Expand Down

0 comments on commit 22fdeeb

Please sign in to comment.