module Distribution.Types.BenchmarkType (
    BenchmarkType(..),
    knownBenchmarkTypes,
) where
import Distribution.Compat.Prelude
import Prelude ()
import Distribution.Parsec.Class
import Distribution.Pretty
import Distribution.Text
import Distribution.Version
import Text.PrettyPrint          (char, text)
data BenchmarkType = BenchmarkTypeExe Version
                     
                   | BenchmarkTypeUnknown String Version
                     
    deriving (Generic, Show, Read, Eq, Typeable, Data)
instance Binary BenchmarkType
instance NFData BenchmarkType where rnf = genericRnf
knownBenchmarkTypes :: [BenchmarkType]
knownBenchmarkTypes = [ BenchmarkTypeExe (mkVersion [1,0]) ]
instance Pretty BenchmarkType where
  pretty (BenchmarkTypeExe ver)          = text "exitcode-stdio-" <<>> pretty ver
  pretty (BenchmarkTypeUnknown name ver) = text name <<>> char '-' <<>> pretty ver
instance Parsec BenchmarkType where
    parsec = parsecStandard $ \ver name -> case name of
       "exitcode-stdio" -> BenchmarkTypeExe ver
       _                -> BenchmarkTypeUnknown name ver
instance Text BenchmarkType where
  parse = stdParse $ \ver name -> case name of
    "exitcode-stdio" -> BenchmarkTypeExe ver
    _                -> BenchmarkTypeUnknown name ver