{-# 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. It takes no command line parameters
     -- and nothing on stdin.
     --
     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
(BenchmarkInterface -> BenchmarkInterface -> Bool)
-> (BenchmarkInterface -> BenchmarkInterface -> Bool)
-> Eq BenchmarkInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BenchmarkInterface -> BenchmarkInterface -> Bool
== :: BenchmarkInterface -> BenchmarkInterface -> Bool
$c/= :: BenchmarkInterface -> BenchmarkInterface -> Bool
/= :: BenchmarkInterface -> BenchmarkInterface -> Bool
Eq, Eq BenchmarkInterface
Eq BenchmarkInterface =>
(BenchmarkInterface -> BenchmarkInterface -> Ordering)
-> (BenchmarkInterface -> BenchmarkInterface -> Bool)
-> (BenchmarkInterface -> BenchmarkInterface -> Bool)
-> (BenchmarkInterface -> BenchmarkInterface -> Bool)
-> (BenchmarkInterface -> BenchmarkInterface -> Bool)
-> (BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface)
-> (BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface)
-> Ord 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
$ccompare :: BenchmarkInterface -> BenchmarkInterface -> Ordering
compare :: BenchmarkInterface -> BenchmarkInterface -> Ordering
$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
>= :: BenchmarkInterface -> BenchmarkInterface -> Bool
$cmax :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
max :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
$cmin :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
min :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
Ord, (forall x. BenchmarkInterface -> Rep BenchmarkInterface x)
-> (forall x. Rep BenchmarkInterface x -> BenchmarkInterface)
-> Generic BenchmarkInterface
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
$cfrom :: forall x. BenchmarkInterface -> Rep BenchmarkInterface x
from :: forall x. BenchmarkInterface -> Rep BenchmarkInterface x
$cto :: forall x. Rep BenchmarkInterface x -> BenchmarkInterface
to :: forall x. Rep BenchmarkInterface x -> BenchmarkInterface
Generic, ReadPrec [BenchmarkInterface]
ReadPrec BenchmarkInterface
Int -> ReadS BenchmarkInterface
ReadS [BenchmarkInterface]
(Int -> ReadS BenchmarkInterface)
-> ReadS [BenchmarkInterface]
-> ReadPrec BenchmarkInterface
-> ReadPrec [BenchmarkInterface]
-> Read BenchmarkInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS BenchmarkInterface
readsPrec :: Int -> ReadS BenchmarkInterface
$creadList :: ReadS [BenchmarkInterface]
readList :: ReadS [BenchmarkInterface]
$creadPrec :: ReadPrec BenchmarkInterface
readPrec :: ReadPrec BenchmarkInterface
$creadListPrec :: ReadPrec [BenchmarkInterface]
readListPrec :: ReadPrec [BenchmarkInterface]
Read, Int -> BenchmarkInterface -> ShowS
[BenchmarkInterface] -> ShowS
BenchmarkInterface -> FilePath
(Int -> BenchmarkInterface -> ShowS)
-> (BenchmarkInterface -> FilePath)
-> ([BenchmarkInterface] -> ShowS)
-> Show BenchmarkInterface
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BenchmarkInterface -> ShowS
showsPrec :: Int -> BenchmarkInterface -> ShowS
$cshow :: BenchmarkInterface -> FilePath
show :: BenchmarkInterface -> FilePath
$cshowList :: [BenchmarkInterface] -> ShowS
showList :: [BenchmarkInterface] -> ShowS
Show, Typeable, Typeable BenchmarkInterface
Typeable BenchmarkInterface =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> BenchmarkInterface
 -> c BenchmarkInterface)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BenchmarkInterface)
-> (BenchmarkInterface -> Constr)
-> (BenchmarkInterface -> DataType)
-> (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))
-> ((forall b. Data b => b -> b)
    -> BenchmarkInterface -> BenchmarkInterface)
-> (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 u.
    (forall d. Data d => d -> u) -> BenchmarkInterface -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> BenchmarkInterface -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> BenchmarkInterface -> m BenchmarkInterface)
-> Data BenchmarkInterface
BenchmarkInterface -> Constr
BenchmarkInterface -> DataType
(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)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> BenchmarkInterface
-> c BenchmarkInterface
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> BenchmarkInterface
-> c BenchmarkInterface
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BenchmarkInterface
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BenchmarkInterface
$ctoConstr :: BenchmarkInterface -> Constr
toConstr :: BenchmarkInterface -> Constr
$cdataTypeOf :: BenchmarkInterface -> DataType
dataTypeOf :: BenchmarkInterface -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BenchmarkInterface)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BenchmarkInterface)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BenchmarkInterface)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BenchmarkInterface)
$cgmapT :: (forall b. Data b => b -> b)
-> BenchmarkInterface -> BenchmarkInterface
gmapT :: (forall b. Data b => b -> b)
-> BenchmarkInterface -> BenchmarkInterface
$cgmapQl :: 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
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BenchmarkInterface -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BenchmarkInterface -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BenchmarkInterface -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BenchmarkInterface -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> BenchmarkInterface -> u
$cgmapM :: forall (m :: * -> *).
Monad 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
$cgmapMp :: 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
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> BenchmarkInterface -> m BenchmarkInterface
Data)

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

instance Monoid BenchmarkInterface where
    mempty :: BenchmarkInterface
mempty  =  BenchmarkType -> BenchmarkInterface
BenchmarkUnsupported (FilePath -> Version -> BenchmarkType
BenchmarkTypeUnknown FilePath
forall a. Monoid a => a
mempty Version
nullVersion)
    mappend :: BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
mappend = BenchmarkInterface -> BenchmarkInterface -> BenchmarkInterface
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