make LTS branch pre-releases
[cabal.git] / Cabal-syntax / src / Distribution / Types / BenchmarkInterface.hs
blob02b208644796db3b5689b67b95ae6f16f4388279
1 {-# LANGUAGE DataKinds #-}
2 {-# LANGUAGE DeriveDataTypeable #-}
3 {-# LANGUAGE DeriveGeneric #-}
5 module Distribution.Types.BenchmarkInterface
6 ( BenchmarkInterface (..)
7 ) where
9 import Distribution.Compat.Prelude
10 import Prelude ()
12 import Distribution.Types.BenchmarkType
13 import Distribution.Utils.Path
14 import Distribution.Version
16 -- | The benchmark interfaces that are currently defined.
18 -- More interfaces may be defined in future, either new revisions or
19 -- totally new interfaces.
20 data BenchmarkInterface
21 = -- | Benchmark interface \"exitcode-stdio-1.0\". The benchmark
22 -- takes the form of an executable. It returns a zero exit code
23 -- for success, non-zero for failure. The stdout and stderr
24 -- channels may be logged. Test tooling may pass command line
25 -- arguments and/or connect the stdin channel to the test.
26 BenchmarkExeV10 Version (RelativePath Source File)
27 | -- | A benchmark that does not conform to one of the above
28 -- interfaces for the given reason (e.g. unknown benchmark type).
29 BenchmarkUnsupported BenchmarkType
30 deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)
32 instance Binary BenchmarkInterface
33 instance Structured BenchmarkInterface
34 instance NFData BenchmarkInterface where rnf = genericRnf
36 instance Monoid BenchmarkInterface where
37 mempty = BenchmarkUnsupported (BenchmarkTypeUnknown mempty nullVersion)
38 mappend = (<>)
40 instance Semigroup BenchmarkInterface where
41 a <> (BenchmarkUnsupported _) = a
42 _ <> b = b