{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}

module Distribution.Types.BenchmarkInterface (
    BenchmarkInterface(..),
) where

import Prelude ()
import Distribution.Compat.Prelude

import Distribution.Types.BenchmarkType
import Distribution.Version

-- | The benchmark interfaces that are currently defined.
--
-- More interfaces may be defined in future, either new revisions or
-- totally new interfaces.
--
data BenchmarkInterface =

     -- | Benchmark interface \"exitcode-stdio-1.0\". The benchmark
     -- takes the form of an executable. It returns a zero exit code
     -- for success, non-zero for failure. The stdout and stderr
     -- channels may be logged. Test tooling may pass command line
     -- arguments and/or connect the stdin channel to the test.
     --
     BenchmarkExeV10 Version FilePath

     -- | A benchmark that does not conform to one of the above
     -- interfaces for the given reason (e.g. unknown benchmark type).
     --
   | BenchmarkUnsupported BenchmarkType
   deriving (BenchmarkInterface -> BenchmarkInterface -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c/= :: BenchmarkInterface -> BenchmarkInterface -> Bool
== :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c== :: BenchmarkInterface -> BenchmarkInterface -> Bool
Eq, Eq BenchmarkInterface
BenchmarkInterface -> BenchmarkInterface -> Bool
BenchmarkInterface -> BenchmarkInterface -> Ordering
BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
$cmin :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
max :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
$cmax :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
>= :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c>= :: BenchmarkInterface -> BenchmarkInterface -> Bool
> :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c> :: BenchmarkInterface -> BenchmarkInterface -> Bool
<= :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c<= :: BenchmarkInterface -> BenchmarkInterface -> Bool
< :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c< :: BenchmarkInterface -> BenchmarkInterface -> Bool
compare :: BenchmarkInterface -> BenchmarkInterface -> Ordering
$ccompare :: BenchmarkInterface -> BenchmarkInterface -> Ordering
Ord, forall x. Rep BenchmarkInterface x -> BenchmarkInterface
forall x. BenchmarkInterface -> Rep BenchmarkInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BenchmarkInterface x -> BenchmarkInterface
$cfrom :: forall x. BenchmarkInterface -> Rep BenchmarkInterface x
Generic, ReadPrec [BenchmarkInterface]
ReadPrec BenchmarkInterface
Int -> ReadS BenchmarkInterface
ReadS [BenchmarkInterface]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BenchmarkInterface]
$creadListPrec :: ReadPrec [BenchmarkInterface]
readPrec :: ReadPrec BenchmarkInterface
$creadPrec :: ReadPrec BenchmarkInterface
readList :: ReadS [BenchmarkInterface]
$creadList :: ReadS [BenchmarkInterface]
readsPrec :: Int -> ReadS BenchmarkInterface
$creadsPrec :: Int -> ReadS BenchmarkInterface
Read, Int -> BenchmarkInterface -> ShowS
[BenchmarkInterface] -> ShowS
BenchmarkInterface -> FilePath
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
showList :: [BenchmarkInterface] -> ShowS
$cshowList :: [BenchmarkInterface] -> ShowS
show :: BenchmarkInterface -> FilePath
$cshow :: BenchmarkInterface -> FilePath
showsPrec :: Int -> BenchmarkInterface -> ShowS
$cshowsPrec :: Int -> BenchmarkInterface -> ShowS
Show, Typeable, Typeable BenchmarkInterface
BenchmarkInterface -> DataType
BenchmarkInterface -> Constr
(forall b. Data b => b -> b)
-> BenchmarkInterface -> BenchmarkInterface
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> BenchmarkInterface -> u
forall u. (forall d. Data d => d -> u) -> BenchmarkInterface -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BenchmarkInterface
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> BenchmarkInterface
-> c BenchmarkInterface
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BenchmarkInterface)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BenchmarkInterface)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BenchmarkInterface -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BenchmarkInterface -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BenchmarkInterface -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BenchmarkInterface -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
gmapT :: (forall b. Data b => b -> b)
-> BenchmarkInterface -> BenchmarkInterface
$cgmapT :: (forall b. Data b => b -> b)
-> BenchmarkInterface -> BenchmarkInterface
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BenchmarkInterface)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BenchmarkInterface)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BenchmarkInterface)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BenchmarkInterface)
dataTypeOf :: BenchmarkInterface -> DataType
$cdataTypeOf :: BenchmarkInterface -> DataType
toConstr :: BenchmarkInterface -> Constr
$ctoConstr :: BenchmarkInterface -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BenchmarkInterface
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BenchmarkInterface
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> BenchmarkInterface
-> c BenchmarkInterface
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> BenchmarkInterface
-> c BenchmarkInterface
Data)

instance Binary BenchmarkInterface
instance Structured BenchmarkInterface
instance NFData BenchmarkInterface where rnf :: BenchmarkInterface -> ()
rnf = forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf

instance Monoid BenchmarkInterface where
    mempty :: BenchmarkInterface
mempty  =  BenchmarkType -> BenchmarkInterface
BenchmarkUnsupported (FilePath -> Version -> BenchmarkType
BenchmarkTypeUnknown forall a. Monoid a => a
mempty Version
nullVersion)
    mappend :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
mappend = forall a. Semigroup a => a -> a -> a
(<>)

instance Semigroup BenchmarkInterface where
    BenchmarkInterface
a <> :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
<> (BenchmarkUnsupported BenchmarkType
_) = BenchmarkInterface
a
    BenchmarkInterface
_ <> BenchmarkInterface
b                        = BenchmarkInterface
b