ghc-8.4.4: The GHC API

Safe HaskellNone
LanguageHaskell2010

TcPluginM

Contents

Description

This module provides an interface for typechecker plugins to access select functions of the TcM, principally those to do with reading parts of the state.

Synopsis

Basic TcPluginM functionality

data TcPluginM a Source #

Instances
Monad TcPluginM # 
Instance details

Defined in TcRnTypes

Functor TcPluginM # 
Instance details

Defined in TcRnTypes

Methods

fmap :: (a -> b) -> TcPluginM a -> TcPluginM b Source #

(<$) :: a -> TcPluginM b -> TcPluginM a Source #

MonadFail TcPluginM # 
Instance details

Defined in TcRnTypes

Methods

fail :: String -> TcPluginM a Source #

Applicative TcPluginM # 
Instance details

Defined in TcRnTypes

Methods

pure :: a -> TcPluginM a Source #

(<*>) :: TcPluginM (a -> b) -> TcPluginM a -> TcPluginM b Source #

liftA2 :: (a -> b -> c) -> TcPluginM a -> TcPluginM b -> TcPluginM c Source #

(*>) :: TcPluginM a -> TcPluginM b -> TcPluginM b Source #

(<*) :: TcPluginM a -> TcPluginM b -> TcPluginM a Source #

tcPluginIO :: IO a -> TcPluginM a Source #

Perform some IO, typically to interact with an external tool.

tcPluginTrace :: String -> SDoc -> TcPluginM () Source #

Output useful for debugging the compiler.

unsafeTcPluginTcM :: TcM a -> TcPluginM a Source #

This function provides an escape for direct access to the TcM monad. It should not be used lightly, and the provided TcPluginM API should be favoured instead.

Finding Modules and Names

data FindResult Source #

The result of searching for an imported module.

NB: FindResult manages both user source-import lookups (which can result in Module) as well as direct imports for interfaces (which always result in InstalledModule).

Constructors

Found ModLocation Module

The module was found

NoPackage UnitId

The requested package was not found

FoundMultiple [(Module, ModuleOrigin)]

_Error_: both in multiple packages

NotFound

Not found

Looking up Names in the typechecking environment

Getting the TcM state

Type variables

Zonking

Creating constraints

newWanted :: CtLoc -> PredType -> TcPluginM CtEvidence Source #

Create a new wanted constraint.

newDerived :: CtLoc -> PredType -> TcPluginM CtEvidence Source #

Create a new derived constraint.

newGiven :: CtLoc -> PredType -> EvTerm -> TcPluginM CtEvidence Source #

Create a new given constraint, with the supplied evidence. This must not be invoked from tcPluginInit or tcPluginStop, or it will panic.

newCoercionHole :: PredType -> TcPluginM CoercionHole Source #

Create a fresh coercion hole.

Manipulating evidence bindings

newEvVar :: PredType -> TcPluginM EvVar Source #

Create a fresh evidence variable.

setEvBind :: EvBind -> TcPluginM () Source #

Bind an evidence variable. This must not be invoked from tcPluginInit or tcPluginStop, or it will panic.

getEvBindsTcPluginM :: TcPluginM EvBindsVar Source #

Access the EvBindsVar carried by the TcPluginM during constraint solving. Returns Nothing if invoked during tcPluginInit or tcPluginStop.