Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data types for compilers and functions for invoking them.
Synopsis
- class Show a => Compiler a where
- compileProgram :: a -> FilePath -> FilePath -> IO Bool
- data SomeCompiler = Compiler a => SomeCompiler a
- data SimpleCompiler = SimpleCompiler {
- scProgram :: FilePath
- scArguments :: [String]
- prependArguments :: [String] -> SimpleCompiler -> SimpleCompiler
- appendArguments :: [String] -> SimpleCompiler -> SimpleCompiler
- overrideCompilerFromEnvironment :: SimpleCompiler -> IO SimpleCompiler
- data CustomCompiler = CustomCompiler {}
- defaultCompiler :: SimpleCompiler
- gppCompiler :: SimpleCompiler
Typeclass
class Show a => Compiler a where Source #
A compiler that exists on the system for compiling C++ code.
compileProgram :: a -> FilePath -> FilePath -> IO Bool Source #
compileProgram compiler infile outfile
invokes the given compiler in
the input file, to produce the output file. If the compiler fails or can't
be called for whatever reason, then an error message is printed to standard
error, and false is returned.
Instances
Compiler CustomCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler compileProgram :: CustomCompiler -> FilePath -> FilePath -> IO Bool Source # | |
Compiler SimpleCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler compileProgram :: SimpleCompiler -> FilePath -> FilePath -> IO Bool Source # | |
Compiler SomeCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler compileProgram :: SomeCompiler -> FilePath -> FilePath -> IO Bool Source # |
data SomeCompiler Source #
An existential data type for Compiler
s.
Compiler a => SomeCompiler a |
Instances
Show SomeCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler showsPrec :: Int -> SomeCompiler -> ShowS # show :: SomeCompiler -> String # showList :: [SomeCompiler] -> ShowS # | |
Compiler SomeCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler compileProgram :: SomeCompiler -> FilePath -> FilePath -> IO Bool Source # |
Data types
data SimpleCompiler Source #
A compiler that can compile a source file into a binary with a single program invocation.
Within the strings in this data type, including the program path, all
occurences of {in}
and {out}
are expanded to the input and desired output
files, respectively.
SimpleCompiler | |
|
Instances
Show SimpleCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler showsPrec :: Int -> SimpleCompiler -> ShowS # show :: SimpleCompiler -> String # showList :: [SimpleCompiler] -> ShowS # | |
Compiler SimpleCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler compileProgram :: SimpleCompiler -> FilePath -> FilePath -> IO Bool Source # |
prependArguments :: [String] -> SimpleCompiler -> SimpleCompiler Source #
Adds arguments to the start of a compiler's argument list.
appendArguments :: [String] -> SimpleCompiler -> SimpleCompiler Source #
Adds arguments to the end of a compiler's argument list.
overrideCompilerFromEnvironment :: SimpleCompiler -> IO SimpleCompiler Source #
Modifies a SimpleCompiler
based on environment variables.
If CXX
is set and non-empty, it will override the compiler's scProgram
.
If CXXFLAGS
is set and non-empty, it will be split into words and each word
will be prepended as an argument to scArguments
. Quoting is not supported.
data CustomCompiler Source #
A Compiler
that allows plugging arbitary logic into the compilation
process.
CustomCompiler | |
|
Instances
Show CustomCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler showsPrec :: Int -> CustomCompiler -> ShowS # show :: CustomCompiler -> String # showList :: [CustomCompiler] -> ShowS # | |
Compiler CustomCompiler Source # | |
Defined in Foreign.Hoppy.Generator.Compiler compileProgram :: CustomCompiler -> FilePath -> FilePath -> IO Bool Source # |
Standard compilers
defaultCompiler :: SimpleCompiler Source #
The default compiler, used by an Interface
that doesn't specify its own. This is:
unsafePerformIO
$overrideCompilerFromEnvironment
gppCompiler
gppCompiler :: SimpleCompiler Source #
The GNU C++ compiler, invoked as g++ -o {out} {in}
.