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

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GHC.Simple

Contents

Description

Simplified interface to the GHC API.

Synopsis

Entry points

compile Source #

Arguments

:: (Intermediate a, Binary b) 
=> (ModMetadata -> a -> IO b)

Compilation function from some intermediate language to the desired output. The output type needs to be an instance of Binary, as it will be cached after compilation to speed up future recompilation. This function is called once per module. Due to caching of modules which don't need to be recompiled, it will not necessarily be called once per module included in the return value of compile.

-> [String]

List of compilation targets. A target can be either a module or a file name.

-> IO (CompResult [CompiledModule b]) 

Compile a list of targets and their dependencies into intermediate code. Uses settings from the the default CompConfig.

compileWith Source #

Arguments

:: (Intermediate a, Binary b) 
=> CompConfig

GHC pipeline configuration.

-> (ModMetadata -> a -> IO b)

Compilation function.

-> [String]

List of compilation targets. A target can be either a module or a file name. Targets may also be read from the specified CompConfig, if cfgUseTargetsFromFlags is set.

-> IO (CompResult [CompiledModule b]) 

Compile a list of targets and their dependencies using a custom configuration.

compileFold Source #

Arguments

:: (Intermediate a, Binary b) 
=> CompConfig

GHC pipeline configuration.

-> (ModMetadata -> a -> IO b)

Per module compilation function.

-> (acc -> CompiledModule b -> IO acc)

Folding function.

-> acc

Initial accumulator.

-> [String]

List of compilation targets. A target can be either a module or a file name. Targets may also be read from the specified CompConfig, if cfgUseTargetsFromFlags is set.

-> IO (CompResult acc) 

Left fold over a list of compilation targets and their dependencies.

Sometimes you don't just want a huge pile of intermediate code lying around; chances are you either want to dump it to file or combine it with some other intermediate code, without having to keep it all in memory at the same time.

Configuration, input and output types

getDynFlagsForConfig :: CompConfig -> IO (DynFlags, [String]) Source #

Obtain the dynamic flags and extra targets that would be used to compile anything with the given config.

GHC re-exports for processing STG and Core

module CoreSyn

module StgSyn

module Module

module Id

module IdInfo

module Var

module Literal

module DataCon

module OccName

module Name

module Type

module TysPrim

module TyCon

module PrimOp

module DynFlags

module SrcLoc

data ModSummary :: * #

A single node in a ModuleGraph. The nodes of the module graph are one of:

  • A regular Haskell source module
  • A hi-boot source module

Constructors

ModSummary 

Fields

data ModGuts :: * #

A ModGuts is carried through the compiler, accumulating stuff as it goes There is only one ModGuts at any time, the one for the module being compiled right now. Once it is compiled, a ModIface and ModDetails are extracted and the ModGuts is discarded.

Constructors

ModGuts 

Fields

type PkgKey = UnitId Source #

Synonym for UnitId, to bridge a slight incompatibility between GHC 7.87.108.0.

pkgKeyString :: PkgKey -> String Source #

String representation of a package ID/key.

modulePkgKey :: Module -> PkgKey Source #

Package ID/key of a module.