ghc-simple-0.4: Simplified interface to the GHC API.

Description

Config, input and output types for the simplified GHC API.

Synopsis

# GHC pipeline configuration

class Intermediate a where Source #

An intermediate source language, usable as the the input for a Compile compilation function.

Minimal complete definition

prepare

Methods

GHC pipeline configuration, parameterized over the intermediate code produced by the pipeline.

Default configuration.

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

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

Modify the dynamic flags governing the compilation process. Changes made here take precedence over any flags passed through cfgGhcFlags.

Default: id

Path to GHC's library directory. If Nothing, the library directory of the system's default GHC compiler will be used.

Default: Nothing

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

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.

Default: Nothing

Stop compilation when any of these this phases are reached, without performing it. If you are doing custom code generation and don't want GHC to generate any code - for instance when writing a cross compiler - you will probably want to set this to ncgPhases.

Default: []

Cache directory for compiled code. If Nothing, the current directory is used.

Default: Nothing

File extension of cache files.

Default: cache

# Convenience functions for common settings combinations

Phases in which the native code generator is invoked. You want to stop at these phases when writing a cross compiler.

Disable any native code generation and linking.

# Compilation results and errors

Metadata for a module under compilation.

Constructors

 ModMetadata FieldsmmSummary :: ModSummaryModSummary for the module, as given by GHC.mmName :: StringString representation of the module's name, not qualified with a package key. ModuleName representation can be obtained from the module's stgModSummary.mmPackageKey :: StringString representation of the module's package key. PackageKey representation can be obtained from the module's stgModSummary.mmSourceIsHsBoot :: BoolWas the module compiler from a hs-boot file?mmSourceFile :: Maybe FilePathThe Haskell source the module was compiled from, if any.mmInterfaceFile :: FilePathInterface file corresponding to this module.

Compiler output and metadata for a given module.

Constructors

 CompiledModule FieldsmodCompiledModule :: aModule data generated by compilation; usually bindings of some kind.modMetadata :: ModMetadataMetadata for the compiled module.modIsTarget :: BoolWas the module a target of the current compilation, as opposed to a dependency of some target?

data CompResult a Source #

Result of a compilation.

Constructors

 Success FieldscompResult :: aResult of the compilation.compWarnings :: [Warning]Warnings that occurred during compilation.compDynFlags :: DynFlagsInitial DynFlags used by this compilation, collected from Config data. Failure FieldscompErrors :: [Error]Errors that occurred during compilation.compWarnings :: [Warning]Warnings that occurred during compilation.

data Error Source #

A GHC error message.

Constructors

 Error FieldserrorSpan :: SrcSpanWhere did the error occur?errorMessage :: StringDescription of the error.errorExtraInfo :: StringMore verbose description of the error.

data Warning Source #

A GHC warning.

Constructors

 Warning FieldswarnSpan :: SrcSpanWhere did the warning occur?warnMessage :: StringWhat was the warning about?

Does the given CompResult represent a successful compilation?