Skip to content

Commit

Permalink
Drop support for ghc < 8.0 as per the new policy
Browse files Browse the repository at this point in the history
  • Loading branch information
UnkindPartition committed Jan 31, 2020
1 parent 0ddf01b commit 62605ec
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 84 deletions.
3 changes: 0 additions & 3 deletions core-tests/Dependencies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import Text.Printf
import qualified Data.IntMap as IntMap
import Control.Monad
import Control.Exception
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (mempty)
#endif

testDependencies :: TestTree
testDependencies = testGroup "Dependencies" $
Expand Down
3 changes: 0 additions & 3 deletions core-tests/Timeouts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import Test.Tasty
import Test.Tasty.Runners
import Test.Tasty.HUnit
import Control.Concurrent
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (mempty)
#endif
import Utils

-- this is a dummy tree we use for testing
Expand Down
3 changes: 0 additions & 3 deletions core-tests/test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import Test.Tasty.Runners
import Test.Tasty.Options
import Test.Tasty.Patterns.Types
import Data.Maybe
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (mempty)
#endif
import Resources
import Timeouts
import Dependencies
Expand Down
5 changes: 5 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

Version ?
---------

* Drop support for GHC versions older than 8.0

Version 1.2.3
-------------

Expand Down
5 changes: 1 addition & 4 deletions core/Test/Tasty/CmdLine.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ module Test.Tasty.CmdLine
) where

import Options.Applicative
import Data.Monoid ((<>))
import Data.Proxy
import Data.Foldable (foldMap)
import Prelude -- Silence AMP and FTP import warnings
import System.Exit
import System.IO

#if !MIN_VERSION_base(4,9,0)
#if !MIN_VERSION_base(4,11,0)
import Data.Monoid
#endif

Expand Down
14 changes: 1 addition & 13 deletions core/Test/Tasty/Ingredients/ConsoleReporter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ import Data.Typeable
import Options.Applicative hiding (str, Success, Failure)
import System.IO
import System.Console.ANSI
#if !MIN_VERSION_base(4,8,0)
import Data.Proxy
import Data.Foldable hiding (concatMap,elem,sequence_)
#endif
#if MIN_VERSION_base(4,9,0)
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup)
import qualified Data.Semigroup (Semigroup((<>)))
#else
import Data.Monoid
#endif

--------------------------------------------------
Expand Down Expand Up @@ -86,10 +80,8 @@ data TestOutput
instance Monoid TestOutput where
mempty = Skip
mappend = Seq
#if MIN_VERSION_base(4,9,0)
instance Semigroup TestOutput where
(<>) = mappend
#endif

type Level = Int

Expand Down Expand Up @@ -283,10 +275,8 @@ data Statistics = Statistics
instance Monoid Statistics where
Statistics t1 f1 `mappend` Statistics t2 f2 = Statistics (t1 + t2) (f1 + f2)
mempty = Statistics 0 0
#if MIN_VERSION_base(4,9,0)
instance Semigroup Statistics where
(<>) = mappend
#endif

-- | @computeStatistics@ computes a summary 'Statistics' for
-- a given state of the 'StatusMap'.
Expand Down Expand Up @@ -574,10 +564,8 @@ instance Ord a => Monoid (Maximum a) where
Maximum a `mappend` Maximum b = Maximum (a `max` b)
MinusInfinity `mappend` a = a
a `mappend` MinusInfinity = a
#if MIN_VERSION_base(4,9,0)
instance Ord a => Semigroup (Maximum a) where
(<>) = mappend
#endif

-- | Compute the amount of space needed to align \"OK\"s and \"FAIL\"s
computeAlignment :: OptionSet -> TestTree -> Int
Expand Down
4 changes: 1 addition & 3 deletions core/Test/Tasty/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Data.Monoid
import Data.Foldable
import Prelude hiding (mod) -- Silence FTP import warnings
import Options.Applicative
#if MIN_VERSION_base(4,9,0)
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup)
import qualified Data.Semigroup (Semigroup((<>)))
#endif
Expand Down Expand Up @@ -88,10 +88,8 @@ instance Monoid OptionSet where
mempty = OptionSet mempty
OptionSet a `mappend` OptionSet b =
OptionSet $ Map.unionWith (flip const) a b
#if MIN_VERSION_base(4,9,0)
instance Semigroup OptionSet where
(<>) = mappend
#endif

-- | Set the option value
setOption :: IsOption v => v -> OptionSet -> OptionSet
Expand Down
4 changes: 0 additions & 4 deletions core/Test/Tasty/Patterns/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import Data.List
import Data.Maybe
import Data.Char
import Test.Tasty.Patterns.Types
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative
import Data.Traversable
#endif

type Path = Seq.Seq String

Expand Down
10 changes: 0 additions & 10 deletions core/Test/Tasty/Patterns/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ type Token = ReadP
newtype Parser a = Parser (ReadP a)
deriving (Functor, Applicative, Alternative, Monad, MonadPlus)

#if !MIN_VERSION_base(4,6,0)
instance Applicative ReadP where
pure = return
(<*>) = ap
instance Alternative ReadP where
empty = mzero
(<|>) = mplus
#endif


data ParseResult a = Success a | Invalid | Ambiguous [a]
deriving Show

Expand Down
8 changes: 1 addition & 7 deletions core/Test/Tasty/Runners/Reducers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,18 @@ module Test.Tasty.Runners.Reducers where

import Control.Applicative
import Prelude -- Silence AMP import warnings
#if MIN_VERSION_base(4,9,0)
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup)
import qualified Data.Semigroup (Semigroup((<>)))
#else
import Data.Monoid
#endif

-- | Monoid generated by '*>'
newtype Traversal f = Traversal { getTraversal :: f () }
instance Applicative f => Monoid (Traversal f) where
mempty = Traversal $ pure ()
Traversal f1 `mappend` Traversal f2 = Traversal $ f1 *> f2
#if MIN_VERSION_base(4,9,0)
instance Applicative f => Semigroup (Traversal f) where
(<>) = mappend
#endif

-- | Monoid generated by @'liftA2' ('<>')@
--
Expand All @@ -69,7 +65,5 @@ newtype Ap f a = Ap { getApp :: f a }
instance (Applicative f, Monoid a) => Monoid (Ap f a) where
mempty = pure mempty
mappend = liftA2 mappend
#if MIN_VERSION_base(4,9,0)
instance (Applicative f, Monoid a) => Semigroup (Ap f a) where
(<>) = mappend
#endif
22 changes: 4 additions & 18 deletions core/Test/Tasty/Runners/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module Test.Tasty.Runners.Utils where

import Control.Exception
import Control.Applicative
import Control.Concurrent (mkWeakThreadId, myThreadId)
import Control.Monad (forM_)
#ifndef VERSION_clock
import Data.Time.Clock.POSIX (getPOSIXTime)
#endif
Expand All @@ -15,22 +17,10 @@ import Foreign.C (CInt)
#ifdef VERSION_clock
import qualified System.Clock as Clock
#endif

import Test.Tasty.Core (Time)

-- We install handlers only on UNIX (obviously) and on GHC >= 7.6.
-- GHC 7.4 lacks mkWeakThreadId (see #181), and this is not important
-- enough to look for an alternative implementation, so we just disable it
-- there.
#define INSTALL_HANDLERS defined __UNIX__ && MIN_VERSION_base(4,6,0)

#if INSTALL_HANDLERS
import Control.Concurrent (mkWeakThreadId, myThreadId)
import Control.Exception (Exception(..), throwTo)
import Control.Monad (forM_)
import System.Posix.Signals
import System.Mem.Weak (deRefWeak)
#endif

import Test.Tasty.Core (Time)

-- | Catch possible exceptions that may arise when evaluating a string.
-- For normal (total) strings, this is a no-op.
Expand Down Expand Up @@ -68,7 +58,6 @@ forceElements = foldr seq ()
-- older than 7.6.
installSignalHandlers :: IO ()
installSignalHandlers = do
#if INSTALL_HANDLERS
main_thread_id <- myThreadId
weak_tid <- mkWeakThreadId main_thread_id
forM_ [ sigABRT, sigBUS, sigFPE, sigHUP, sigILL, sigQUIT, sigSEGV,
Expand All @@ -80,9 +69,6 @@ installSignalHandlers = do
case m of
Nothing -> return ()
Just tid -> throwTo tid (toException $ SignalException sig)
#else
return ()
#endif

-- | This exception is thrown when the program receives a signal, assuming
-- 'installSignalHandlers' was called.
Expand Down
6 changes: 1 addition & 5 deletions core/tasty.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ library
Test.Tasty.Ingredients.ListTests
Test.Tasty.Ingredients.IncludingOptions
build-depends:
base >= 4.5 && < 5,
base >= 4.9 && < 5,
stm >= 2.3,
containers,
mtl >= 2.1.3.1,
Expand All @@ -73,10 +73,6 @@ library
else
build-depends: time >= 1.4

if impl(ghc < 7.6)
-- for GHC.Generics
build-depends: ghc-prim

if !os(windows) && !impl(ghcjs)
build-depends: unix,
wcwidth
Expand Down
5 changes: 0 additions & 5 deletions quickcheck/Test/Tasty/QuickCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ import Text.Printf
import Test.QuickCheck.Random (mkQCGen)
import Options.Applicative (metavar)
import System.Random (getStdRandom, randomR)
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative
import Data.Monoid
import Data.Proxy
#endif

newtype QC = QC QC.Property
deriving Typeable
Expand Down
3 changes: 0 additions & 3 deletions quickcheck/tests/test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import Test.Tasty.HUnit
import Data.Maybe
import Text.Regex.PCRE.Light.Char8
import Text.Printf
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (mempty)
#endif

(=~), (!~)
:: String -- ^ text
Expand Down
3 changes: 0 additions & 3 deletions smallcheck/Test/Tasty/SmallCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import Data.Typeable
import Data.IORef
import Options.Applicative (metavar)
import Text.Printf
#if !MIN_VERSION_base(4,8,0)
import Data.Proxy
#endif

-- | Create a 'Test' for a SmallCheck 'SC.Testable' property
testProperty :: SC.Testable IO a => TestName -> a -> TestTree
Expand Down

0 comments on commit 62605ec

Please sign in to comment.