Safe Haskell | None |
---|---|
Language | Haskell2010 |
Config, input and output types for the simplified GHC API.
- class Compile a where
- toCode :: ModSummary -> Ghc a
- data CompConfig a
- defaultConfig :: Compile a => CompConfig a
- cfgGhcFlags :: CompConfig a -> [String]
- cfgUseTargetsFromFlags :: CompConfig a -> Bool
- cfgUpdateDynFlags :: CompConfig a -> DynFlags -> DynFlags
- cfgGhcLibDir :: CompConfig a -> Maybe FilePath
- cfgUseGhcErrorLogger :: CompConfig a -> Bool
- cfgCustomPrimIface :: CompConfig a -> Maybe (PrimOp -> PrimOpInfo, PrimOp -> Arity -> StrictSig)
- cfgGhcPipeline :: CompConfig a -> ModSummary -> Ghc a
- data CompiledModule a = CompiledModule {}
- data CompResult a
- = Success {
- compResult :: a
- compWarnings :: [Warning]
- compDynFlags :: DynFlags
- | Failure {
- compErrors :: [Error]
- compWarnings :: [Warning]
- = Success {
- data Error = Error {}
- data Warning = Warning {
- warnSpan :: SrcSpan
- warnMessage :: String
- compSuccess :: CompResult a -> Bool
GHC pipeline configuration
Any type we can generate intermediate code for.
toCode :: ModSummary -> Ghc a Source
Generate some sort of code (or other output) from a Haskell module.
data CompConfig a Source
GHC pipeline configuration, parameterized over the intermediate code produced by the pipeline.
defaultConfig :: Compile a => CompConfig a Source
Default configuration.
cfgGhcFlags :: CompConfig a -> [String] Source
GHC command line dynamic flags to control the Haskell to STG
compilation pipeline.
For instance, passing ["-O2", "-DHELLO"]
here is equivalent to
passing -O2 -DHELLO
to the ghc
binary.
Note that flags set here are overridden by any changes to DynFlags
performed by cfgUpdateDynFlags
, and that '--make' mode is always
in effect.
Default: []
cfgUseTargetsFromFlags :: CompConfig a -> Bool Source
If file or module names are found among the cfgGhcFlags
,
should they be used as targets, in addition to any targets given by
other arguments to withStg
et al?
Default: True
cfgUpdateDynFlags :: CompConfig a -> DynFlags -> DynFlags Source
Modify the dynamic flags governing the compilation process.
Changes made here take precedence over any flags passed through
cfgGhcFlags
.
Default: id
cfgGhcLibDir :: CompConfig a -> Maybe FilePath Source
Path to GHC's library directory. If Nothing
, the library directory
of the system's default GHC compiler will be used.
Default: Nothing
cfgUseGhcErrorLogger :: CompConfig a -> Bool Source
Use GHC's standard logger to log errors and warnings to the command line? Errors and warnings are always collected and returned, regardless of the value of this setting.
Output other than errors and warnings (dumps, etc.) are logged using
the standard logger by default. For finer control over logging
behavior, you should override log_action
in cfgUpdateDynFlags
.
Default: False
cfgCustomPrimIface :: CompConfig a -> Maybe (PrimOp -> PrimOpInfo, PrimOp -> Arity -> StrictSig) Source
Use a custom interface for GHC.Prim
.
This is useful if you want to, for instance, compile to a 32 bit
target architecture on a 64 bit host.
For more information, see Language.Haskell.GHC.Simple.PrimIface.
Default: Nothing
cfgGhcPipeline :: CompConfig a -> ModSummary -> Ghc a Source
Use a custom GHC pipeline to generate intermediate code. Useful if
the provided instances for [StgBinding]
etc. don't quite do what you
want them to. See Language.Haskell.GHC.Simple.Impl for more
information about custom pipelines.
Default: toCode
Compilation results and errors
data CompiledModule a Source
Compiler output and metadata for a given module.
CompiledModule | |
|
data CompResult a Source
Result of a compilation.
Success | |
| |
Failure | |
|
A GHC error message.
Error | |
|
A GHC warning.
Warning | |
|
compSuccess :: CompResult a -> Bool Source
Does the given CompResult
represent a successful compilation?