ghc-tcplugins-extra-0.1: Utilities for writing GHC type-checker plugins

Copyright(C) 2015, University of Twente
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010
Extensions
  • Cpp
  • DisambiguateRecordFields
  • RecordWildCards
  • LambdaCase

GHC.TcPluginM.Extra

Contents

Description

 

Synopsis

Create new constraints

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

Create a new [W]anted constraint.

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

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

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

Create a new [D]erived constraint.

newWantedWithProvenance Source

Arguments

:: CtEvidence

Constraint from which the new wanted is derived

-> PredType

The type of the new constraint

-> TcPluginM CtEvidence 

Create a new [W]anted constraint that remembers from which wanted constraint it was derived

Creating evidence

evByFiat Source

Arguments

:: String

Name the coercion should have

-> Type

The LHS of the equivalence relation (~)

-> Type

The RHS of the equivalence relation (~)

-> EvTerm 

The EvTerm equivalent for unsafeCoerce

Report contractions

failWithProvenace :: Ct -> TcPluginM TcPluginResult Source

Mark the given constraint as insoluble.

If the [W]anted constraint was made by newWantedWithProvenance, it will also mark the parent(s) from which the constraint was derived as insoluble. Even if they were previously assumed to be solved.

Lookup

lookupModule Source

Arguments

:: ModuleName

Name of the module

-> FastString

Name of the package containing the module

-> TcPluginM Module 

Find a module

Trace state of the plugin

tracePlugin :: String -> TcPlugin -> TcPlugin Source

Print out extra information about the initialisation, stop, and every run of the plugin when -ddump-tc-trace is enabled.