ghc-8.8.4: The GHC API
Safe HaskellNone
LanguageHaskell2010

Plugins

Synopsis

Plugins

data Plugin Source #

Plugin is the compiler plugin data type. Try to avoid constructing one of these directly, and just modify some fields of defaultPlugin instead: this is to try and preserve source-code compatibility when we add fields to this.

Nonetheless, this API is preliminary and highly likely to change in the future.

Constructors

Plugin 

Fields

defaultPlugin :: Plugin Source #

Default plugin: does nothing at all! For compatibility reasons you should base all your plugin definitions on this default value.

type CommandLineOption = String Source #

Command line options gathered from the -PModule.Name:stuff syntax are given to you as this type

Recompilation checking

Plugin types

Frontend plugins

Core plugins

Core plugins allow plugins to register as a Core-to-Core pass.

Typechecker plugins

Typechecker plugins allow plugins to provide evidence to the typechecker.

Source plugins

GHC offers a number of points where plugins can access and modify its front-end ("source") representation. These include:

keepRenamedSource :: [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn) Source #

A renamer plugin which mades the renamed source available in a typechecker plugin.

Internal

data PluginWithArgs Source #

Constructors

PluginWithArgs 

Fields

data LoadedPlugin Source #

A plugin with its arguments. The result of loading the plugin.

Constructors

LoadedPlugin 

Fields

data StaticPlugin Source #

A static plugin with its arguments. For registering compiled-in plugins through the GHC API.

Constructors

StaticPlugin 

Fields

withPlugins :: Monad m => DynFlags -> PluginOperation m a -> a -> m a Source #

Perform an operation by using all of the plugins in turn.

withPlugins_ :: Monad m => DynFlags -> ConstPluginOperation m a -> a -> m () Source #

Perform a constant operation by using all of the plugins in turn.