ghc-toolchain-0.1.0.0: Utility for managing GHC target toolchains
Safe HaskellNone
LanguageHaskell2010

GHC.Toolchain.Program

Synopsis

Documentation

data Program Source #

Constructors

Program 

Fields

Instances

Instances details
Read Program Source # 
Instance details

Defined in GHC.Toolchain.Program

Show Program Source # 
Instance details

Defined in GHC.Toolchain.Program

Eq Program Source # 
Instance details

Defined in GHC.Toolchain.Program

Methods

(==) :: Program -> Program -> Bool #

(/=) :: Program -> Program -> Bool #

Ord Program Source # 
Instance details

Defined in GHC.Toolchain.Program

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 Programs

data ProgOpt Source #

Program specifier from the command-line.

Constructors

ProgOpt 

Fields

programFromOpt Source #

Arguments

:: ProgOpt 
-> FilePath

Program path to default to

-> [String]

Program flags to default to

-> Program 

Make a Program from user specified program options (ProgOpt), defaulting to the given path and flags if unspecified in the ProgOpt.

findProgram Source #

Arguments

:: String 
-> ProgOpt

path provided by user

-> [FilePath]

candidate names

-> M Program 

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

compile Source #

Arguments

:: 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

supportsTarget Source #

Arguments

:: ArchOS 
-> Lens compiler Program 
-> (compiler -> M ())

Action to check if compiler with --target flag works

-> String

The LLVM target to use if cc supports --target

-> compiler

The compiler to check --target support for

-> M compiler

Return compiler with --target flag if supported

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).