{-# LANGUAGE Safe #-}
module Cli.Programs (
CompilerBackend(..),
CxxCommand(..),
TestCommand(..),
TestCommandResult(..),
VersionHash(..),
) where
import Control.Monad.IO.Class
import Base.CompilerError
class CompilerBackend b where
runCxxCommand :: (MonadIO m, ErrorContextM m) => b -> CxxCommand -> m FilePath
runTestCommand :: (MonadIO m, ErrorContextM m) => b -> TestCommand -> m TestCommandResult
getCompilerHash :: b -> VersionHash
newtype VersionHash = VersionHash String deriving (VersionHash -> VersionHash -> Bool
(VersionHash -> VersionHash -> Bool)
-> (VersionHash -> VersionHash -> Bool) -> Eq VersionHash
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VersionHash -> VersionHash -> Bool
$c/= :: VersionHash -> VersionHash -> Bool
== :: VersionHash -> VersionHash -> Bool
$c== :: VersionHash -> VersionHash -> Bool
Eq)
instance Show VersionHash where
show :: VersionHash -> String
show (VersionHash String
h) = String
h
data CxxCommand =
CompileToObject {
CxxCommand -> String
ctoSource :: FilePath,
CxxCommand -> String
ctoPath :: FilePath,
CxxCommand -> [(String, Maybe String)]
ctoMacros :: [(String,Maybe String)],
CxxCommand -> [String]
ctoPaths :: [FilePath],
:: Bool
} |
CompileToShared {
CxxCommand -> [String]
ctsSources :: [FilePath],
CxxCommand -> String
ctsOutput :: FilePath,
CxxCommand -> [String]
ctsLinkFlags :: [String]
} |
CompileToBinary {
CxxCommand -> String
ctbMain :: FilePath,
CxxCommand -> [String]
ctbSources :: [FilePath],
CxxCommand -> [(String, Maybe String)]
ctbMacros :: [(String,Maybe String)],
CxxCommand -> String
ctbOutput :: FilePath,
CxxCommand -> [String]
ctbPaths :: [FilePath],
CxxCommand -> [String]
ctbLinkFlags :: [String]
}
deriving (Int -> CxxCommand -> ShowS
[CxxCommand] -> ShowS
CxxCommand -> String
(Int -> CxxCommand -> ShowS)
-> (CxxCommand -> String)
-> ([CxxCommand] -> ShowS)
-> Show CxxCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CxxCommand] -> ShowS
$cshowList :: [CxxCommand] -> ShowS
show :: CxxCommand -> String
$cshow :: CxxCommand -> String
showsPrec :: Int -> CxxCommand -> ShowS
$cshowsPrec :: Int -> CxxCommand -> ShowS
Show)
data TestCommand =
TestCommand {
TestCommand -> String
tcBinary :: FilePath,
TestCommand -> String
tcPath :: FilePath,
TestCommand -> [String]
tcArgs :: [String]
}
deriving (Int -> TestCommand -> ShowS
[TestCommand] -> ShowS
TestCommand -> String
(Int -> TestCommand -> ShowS)
-> (TestCommand -> String)
-> ([TestCommand] -> ShowS)
-> Show TestCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestCommand] -> ShowS
$cshowList :: [TestCommand] -> ShowS
show :: TestCommand -> String
$cshow :: TestCommand -> String
showsPrec :: Int -> TestCommand -> ShowS
$cshowsPrec :: Int -> TestCommand -> ShowS
Show)
data TestCommandResult =
TestCommandResult {
TestCommandResult -> Bool
tcrSuccess :: Bool,
TestCommandResult -> [String]
tcrOutput :: [String],
TestCommandResult -> [String]
tcrError :: [String]
}
deriving (Int -> TestCommandResult -> ShowS
[TestCommandResult] -> ShowS
TestCommandResult -> String
(Int -> TestCommandResult -> ShowS)
-> (TestCommandResult -> String)
-> ([TestCommandResult] -> ShowS)
-> Show TestCommandResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestCommandResult] -> ShowS
$cshowList :: [TestCommandResult] -> ShowS
show :: TestCommandResult -> String
$cshow :: TestCommandResult -> String
showsPrec :: Int -> TestCommandResult -> ShowS
$cshowsPrec :: Int -> TestCommandResult -> ShowS
Show)