Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Program = Program {}
- shProgram :: Program
- _prgPath :: Lens Program FilePath
- _prgFlags :: Lens Program [String]
- addFlagIfNew :: String -> Program -> Program
- runProgram :: Program -> [String] -> M ExitCode
- callProgram :: Program -> [String] -> M ()
- readProgram :: Program -> [String] -> M (ExitCode, String, String)
- readProgramStdout :: Program -> [String] -> M String
- data ProgOpt = ProgOpt {}
- emptyProgOpt :: ProgOpt
- programFromOpt :: ProgOpt -> FilePath -> [String] -> Program
- _poPath :: Lens ProgOpt (Maybe FilePath)
- _poFlags :: Lens ProgOpt (Maybe [String])
- findProgram :: String -> ProgOpt -> [FilePath] -> M Program
- compile :: FilePath -> [String] -> Lens compiler Program -> compiler -> FilePath -> String -> M ()
- supportsTarget :: ArchOS -> Lens compiler Program -> (compiler -> M ()) -> String -> compiler -> M compiler
Documentation
addFlagIfNew :: String -> Program -> Program Source #
Prepends a flag to a program's flags if the flag is not in the existing flags.
Running programs
readProgram :: Program -> [String] -> M (ExitCode, String, String) Source #
Runs a program with a list of arguments and returns the exit code and the stdout and stderr output
readProgramStdout :: Program -> [String] -> M String Source #
Runs a program with a list of arguments and returns the stdout output, ignoring the exit code.
Finding Program
s
Program specifier from the command-line.
Tries to find the user specified program by path or tries to look for one in the given list of candidates.
If the ProgOpt
program flags are unspecified the program will have an empty list of flags.
Compiler programs
:: FilePath | input extension |
-> [String] | extra flags |
-> Lens compiler Program | |
-> compiler | |
-> FilePath | output path |
-> String | source |
-> M () |
Compile a program with a given compiler.
The compiler must
* Take the program path as a positional argument
* Accept -o
to specify output path
:: ArchOS | |
-> Lens compiler Program | |
-> (compiler -> M ()) | Action to check if compiler with |
-> String | The LLVM target to use if |
-> compiler | The compiler to check |
-> M compiler | Return compiler with |
Does compiler program support the --target=triple
option? If so, we should
pass it whenever possible to avoid ambiguity and potential compile-time
errors (e.g. see #20162).