Safe Haskell | None |
---|---|
Language | Haskell2010 |
The GHC API changes over time. This module re-exports most GHC imports needed by typechecker plugins and has a stable API over multiple GHC versions.
Synopsis
- data Plugin = Plugin {
- installCoreToDos :: CorePlugin
- tcPlugin :: TcPlugin
- holeFitPlugin :: HoleFitPlugin
- dynflagsPlugin :: [CommandLineOption] -> DynFlags -> IO DynFlags
- pluginRecompile :: [CommandLineOption] -> IO PluginRecompile
- parsedResultAction :: [CommandLineOption] -> ModSummary -> HsParsedModule -> Hsc HsParsedModule
- renamedResultAction :: [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)
- typeCheckResultAction :: [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv
- spliceRunAction :: [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)
- interfaceLoadAction :: forall lcl. [CommandLineOption] -> ModIface -> IfM lcl ModIface
- defaultPlugin :: Plugin
- flagRecompile :: [CommandLineOption] -> IO PluginRecompile
- impurePlugin :: [CommandLineOption] -> IO PluginRecompile
- purePlugin :: [CommandLineOption] -> IO PluginRecompile
- data PluginRecompile
- data FindResult
- = Found ModLocation Module
- | NoPackage UnitId
- | FoundMultiple [(Module, ModuleOrigin)]
- | NotFound {
- fr_paths :: [FilePath]
- fr_pkg :: Maybe UnitId
- fr_mods_hidden :: [UnitId]
- fr_pkgs_hidden :: [UnitId]
- fr_unusables :: [(UnitId, UnusablePackageReason)]
- fr_suggestions :: [ModuleSuggestion]
- promotedFalseDataCon :: TyCon
- promotedTrueDataCon :: TyCon
- consDataCon :: DataCon
- nilDataCon :: DataCon
- boolTyCon :: TyCon
- heqDataCon :: DataCon
- typeSymbolKindCon :: TyCon
- typeNatKindCon :: TyCon
- promoteDataCon :: DataCon -> TyCon
- dataConWrapId :: DataCon -> Id
- mkPrimEqPred :: Type -> Type -> Type
- typeKind :: HasDebugCallStack => Type -> Kind
- nonDetCmpTypes :: [Type] -> [Type] -> Ordering
- nonDetCmpType :: Type -> Type -> Ordering
- tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
- mkTyConApp :: TyCon -> [Type] -> Type
- splitFunTy_maybe :: Type -> Maybe (Type, Type)
- isStrLitTy :: Type -> Maybe FastString
- mkStrLitTy :: FastString -> Type
- isNumLitTy :: Type -> Maybe Integer
- mkNumLitTy :: Integer -> Type
- getTyVar_maybe :: Type -> Maybe TyVar
- tyCoVarsOfTypes :: [Type] -> TyCoVarSet
- tyCoVarsOfType :: Type -> TyCoVarSet
- mkTyVarTy :: TyVar -> Type
- coreView :: Type -> Maybe Type
- splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
- tyConDataCons :: TyCon -> [DataCon]
- isFamilyTyCon :: TyCon -> Bool
- elemVarSet :: Var -> VarSet -> Bool
- type TyCoVarSet = UniqSet TyCoVar
- mkUnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
- data Role
- dataConName :: DataCon -> Name
- isTcTyVar :: Var -> Bool
- mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar
- tyVarKind :: TyVar -> Kind
- type Id = Var
- type TyVar = Var
- type DFunId = Id
- typeSymbolKind :: Kind
- heqTyCon :: TyCon
- mkSysTvName :: Unique -> FastString -> Name
- getOccName :: NamedThing a => a -> OccName
- data Coercion
- type PredType = Type
- type Kind = Type
- data Var
- occNameString :: OccName -> String
- mkTcOcc :: String -> OccName
- occName :: HasOccName name => name -> OccName
- mkModuleName :: String -> ModuleName
- moduleNameString :: ModuleName -> String
- getUnique :: Uniquable a => a -> Unique
- unLoc :: HasSrcSpan a => a -> SrcSpanLess a
- vcat :: [SDoc] -> SDoc
- ($$) :: SDoc -> SDoc -> SDoc
- (<+>) :: SDoc -> SDoc -> SDoc
- (<>) :: SDoc -> SDoc -> SDoc
- class Outputable a where
- data Module
- data ModuleName
- fsLit :: String -> FastString
- unpackFS :: FastString -> String
- data FastString = FastString {
- uniq :: !Int
- n_chars :: !Int
- fs_bs :: !ByteString
- fs_zenc :: FastZString
- thenCmp :: Ordering -> Ordering -> Ordering
- data TyCon
- showSDocUnsafe :: SDoc -> String
- text :: String -> SDoc
- occNameFS :: OccName -> FastString
- isGiven :: CtEvidence -> Bool
- isWanted :: CtEvidence -> Bool
- ctEvPred :: CtEvidence -> TcPredType
- isGivenCt :: Ct -> Bool
- ctPred :: Ct -> PredType
- ctLoc :: Ct -> CtLoc
- ctEvidence :: Ct -> CtEvidence
- mkNonCanonical :: CtEvidence -> Ct
- data Ct
- = CDictCan {
- cc_ev :: CtEvidence
- cc_class :: Class
- cc_tyargs :: [Xi]
- cc_pend_sc :: Bool
- | CIrredCan {
- cc_ev :: CtEvidence
- cc_insol :: Bool
- | CTyEqCan { }
- | CFunEqCan { }
- | CNonCanonical {
- cc_ev :: CtEvidence
- | CHoleCan {
- cc_ev :: CtEvidence
- cc_hole :: Hole
- | CQuantCan QCInst
- = CDictCan {
- data WantedConstraints
- data CtLoc
- classifyPredType :: PredType -> Pred
- data Pred
- data EqRel
- evDFunApp :: DFunId -> [Type] -> [EvExpr] -> EvTerm
- evCast :: EvExpr -> TcCoercion -> EvTerm
- type TcCoercion = Coercion
- type TcCoercionR = CoercionR
- data EvTerm
- type EvExpr = CoreExpr
- zonkCt :: Ct -> TcPluginM Ct
- isTouchableTcPluginM :: TcTyVar -> TcPluginM Bool
- newFlexiTyVar :: Kind -> TcPluginM TcTyVar
- newUnique :: TcPluginM Unique
- matchFam :: TyCon -> [Type] -> TcPluginM (Maybe (TcCoercion, TcType))
- findImportedModule :: ModuleName -> Maybe FastString -> TcPluginM FindResult
- tcPluginTrace :: String -> SDoc -> TcPluginM ()
- tcPluginIO :: IO a -> TcPluginM a
- unsafeTcPluginTcM :: TcM a -> TcPluginM a
- data TcPluginM a
- data TcPlugin = TcPlugin {
- tcPluginInit :: TcPluginM s
- tcPluginSolve :: s -> TcPluginSolver
- tcPluginStop :: s -> TcPluginM ()
- data TcPluginResult
- = TcPluginContradiction [Ct]
- | TcPluginOk [(EvTerm, Ct)] [Ct]
- tcGetTyVar_maybe :: Type -> Maybe TyVar
- isMetaTyVar :: TcTyVar -> Bool
- vanillaSkolemTv :: TcTyVarDetails
- data Type
- data UnivCoProvenance = PluginProv String
- nonDetCmpUnique :: Unique -> Unique -> Ordering
- tracePlugin :: String -> TcPlugin -> TcPlugin
- lookupName :: Module -> OccName -> TcPluginM Name
- lookupModule :: ModuleName -> FastString -> TcPluginM Module
- evByFiat :: String -> Type -> Type -> EvTerm
- typeNatSubTyCon :: TyCon
- typeNatAddTyCon :: TyCon
- naturalTy :: Kind
- naturalTyCon :: TyCon
- data HsModule pass = HsModule {
- hsmodName :: Maybe (Located ModuleName)
- hsmodExports :: Maybe (Located [LIE pass])
- hsmodImports :: [LImportDecl pass]
- hsmodDecls :: [LHsDecl pass]
- hsmodDeprecMessage :: Maybe (Located WarningTxt)
- hsmodHaddockModHeader :: Maybe LHsDocString
- data Class
- data HsParsedModule = HsParsedModule {}
- readMutVar :: IORef a -> IOEnv env a
- writeMutVar :: IORef a -> a -> IOEnv env ()
- newMutVar :: a -> IOEnv env (IORef a)
- tcLookupClass :: Name -> TcPluginM Class
- tcLookupTyCon :: Name -> TcPluginM TyCon
- lookupOrig :: Module -> OccName -> TcPluginM Name
Imports from
GhcPlugins
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.
Plugin | |
|
defaultPlugin :: Plugin #
Default plugin: does nothing at all, except for marking that safe
inference has failed unless -fplugin-trustworthy
is passed. For
compatibility reaso you should base all your plugin definitions on this
default value.
flagRecompile :: [CommandLineOption] -> IO PluginRecompile #
impurePlugin :: [CommandLineOption] -> IO PluginRecompile #
purePlugin :: [CommandLineOption] -> IO PluginRecompile #
data PluginRecompile #
Instances
Semigroup PluginRecompile | |
Defined in Plugins (<>) :: PluginRecompile -> PluginRecompile -> PluginRecompile # sconcat :: NonEmpty PluginRecompile -> PluginRecompile # stimes :: Integral b => b -> PluginRecompile -> PluginRecompile # | |
Monoid PluginRecompile | |
Defined in Plugins mappend :: PluginRecompile -> PluginRecompile -> PluginRecompile # mconcat :: [PluginRecompile] -> PluginRecompile # | |
Outputable PluginRecompile | |
Defined in Plugins ppr :: PluginRecompile -> SDoc # pprPrec :: Rational -> PluginRecompile -> SDoc # |
data FindResult #
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
).
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 |
|
consDataCon :: DataCon #
nilDataCon :: DataCon #
heqDataCon :: DataCon #
typeNatKindCon :: TyCon #
promoteDataCon :: DataCon -> TyCon #
dataConWrapId :: DataCon -> Id #
Returns an Id which looks like the Haskell-source constructor by using
the wrapper if it exists (see dataConWrapId_maybe
) and failing over to
the worker (see dataConWorkId
)
mkPrimEqPred :: Type -> Type -> Type #
Creates a primitive type equality predicate. Invariant: the types are not Coercions
typeKind :: HasDebugCallStack => Type -> Kind #
nonDetCmpTypes :: [Type] -> [Type] -> Ordering #
nonDetCmpType :: Type -> Type -> Ordering #
tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type]) #
Split a type constructor application into its type constructor and
applied types. Note that this may fail in the case of a FunTy
with an
argument of unknown kind FunTy
(e.g. FunTy (a :: k) Int
. since the kind
of a
isn't of the form TYPE rep
). Consequently, you may need to zonk your
type before using this function.
If you only need the TyCon
, consider using tcTyConAppTyCon_maybe
.
mkTyConApp :: TyCon -> [Type] -> Type #
splitFunTy_maybe :: Type -> Maybe (Type, Type) #
Attempts to extract the argument and result types from a type
isStrLitTy :: Type -> Maybe FastString #
Is this a symbol literal. We also look through type synonyms.
mkStrLitTy :: FastString -> Type #
isNumLitTy :: Type -> Maybe Integer #
Is this a numeric literal. We also look through type synonyms.
mkNumLitTy :: Integer -> Type #
tyCoVarsOfTypes :: [Type] -> TyCoVarSet #
tyCoVarsOfType :: Type -> TyCoVarSet #
coreView :: Type -> Maybe Type #
This function Strips off the top layer only of a type synonym
application (if any) its underlying representation type.
Returns Nothing if there is nothing to look through.
This function considers Constraint
to be a synonym of TYPE LiftedRep
.
By being non-recursive and inlined, this case analysis gets efficiently joined onto the case analysis that the caller is already doing
splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) #
Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor
tyConDataCons :: TyCon -> [DataCon] #
As tyConDataCons_maybe
, but returns the empty list of constructors if no
constructors could be found
isFamilyTyCon :: TyCon -> Bool #
Is this a TyCon
, synonym or otherwise, that defines a family?
elemVarSet :: Var -> VarSet -> Bool #
type TyCoVarSet = UniqSet TyCoVar #
Type or Coercion Variable Set
:: UnivCoProvenance | |
-> Role | role of the built coercion, "r" |
-> Type | t1 :: k1 |
-> Type | t2 :: k2 |
-> Coercion | :: t1 ~r t2 |
Make a universal coercion between two arbitrary types.
Instances
Eq Role | |
Data Role | |
Defined in CoAxiom gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role # dataTypeOf :: Role -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) # gmapT :: (forall b. Data b => b -> b) -> Role -> Role # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r # gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role # | |
Ord Role | |
Binary Role | |
Outputable Role | |
typeSymbolKind :: Kind #
mkSysTvName :: Unique -> FastString -> Name #
getOccName :: NamedThing a => a -> OccName #
A Coercion
is concrete evidence of the equality/convertibility
of two types.
Instances
Data Coercion | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Coercion -> c Coercion # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Coercion # toConstr :: Coercion -> Constr # dataTypeOf :: Coercion -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Coercion) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Coercion) # gmapT :: (forall b. Data b => b -> b) -> Coercion -> Coercion # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r # gmapQ :: (forall d. Data d => d -> u) -> Coercion -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Coercion -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion # | |
Outputable Coercion | |
A type of the form p
of constraint kind represents a value whose type is
the Haskell predicate p
, where a predicate is what occurs before
the =>
in a Haskell type.
We use PredType
as documentation to mark those types that we guarantee to
have this kind.
It can be expanded into its representation, but:
- The type checker must treat it as opaque
- The rest of the compiler treats it as transparent
Consider these examples:
f :: (Eq a) => a -> Int g :: (?x :: Int -> Int) => a -> Int h :: (r\l) => {r} => {l::Int | r}
Here the Eq a
and ?x :: Int -> Int
and rl
are all called "predicates"
Variable
Essentially a typed Name
, that may also contain some additional information
about the Var
and its use sites.
Instances
Eq Var | |
Data Var | |
Defined in Var gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var # dataTypeOf :: Var -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) # gmapT :: (forall b. Data b => b -> b) -> Var -> Var # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # | |
Ord Var | |
NamedThing Var | |
HasOccName Var | |
Uniquable Var | |
Outputable Var | |
occNameString :: OccName -> String #
occName :: HasOccName name => name -> OccName #
mkModuleName :: String -> ModuleName #
moduleNameString :: ModuleName -> String #
unLoc :: HasSrcSpan a => a -> SrcSpanLess a #
($$) :: SDoc -> SDoc -> SDoc #
Join two SDoc
together vertically; if there is
no vertical overlap it "dovetails" the two onto one line
class Outputable a where #
Class designating that some type has an SDoc
representation
Nothing
Instances
A Module is a pair of a UnitId
and a ModuleName
.
Module variables (i.e. H
) which can be instantiated to a
specific module at some later point in time are represented
with moduleUnitId
set to holeUnitId
(this allows us to
avoid having to make moduleUnitId
a partial operation.)
Instances
data ModuleName #
A ModuleName is essentially a simple string, e.g. Data.List
.
Instances
fsLit :: String -> FastString #
unpackFS :: FastString -> String #
Unpacks and decodes the FastString
data FastString #
A FastString
is a UTF-8 encoded string together with a unique ID. All
FastString
s are stored in a global hashtable to support fast O(1)
comparison.
It is also associated with a lazy reference to the Z-encoding of this string which is used by the compiler internally.
FastString | |
|
Instances
TyCons represent type constructors. Type constructors are introduced by things such as:
1) Data declarations: data Foo = ...
creates the Foo
type constructor of
kind *
2) Type synonyms: type Foo = ...
creates the Foo
type constructor
3) Newtypes: newtype Foo a = MkFoo ...
creates the Foo
type constructor
of kind * -> *
4) Class declarations: class Foo where
creates the Foo
type constructor
of kind *
This data type also encodes a number of primitive, built in type constructors such as those for function and tuple types.
Instances
Eq TyCon | |
Data TyCon | |
Defined in TyCon gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyCon -> c TyCon # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyCon # dataTypeOf :: TyCon -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyCon) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyCon) # gmapT :: (forall b. Data b => b -> b) -> TyCon -> TyCon # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r # gmapQ :: (forall d. Data d => d -> u) -> TyCon -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyCon -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon # | |
NamedThing TyCon | |
Uniquable TyCon | |
Outputable TyCon | |
showSDocUnsafe :: SDoc -> String #
occNameFS :: OccName -> FastString #
Constraint
isGiven :: CtEvidence -> Bool #
isWanted :: CtEvidence -> Bool #
ctEvPred :: CtEvidence -> TcPredType #
ctEvidence :: Ct -> CtEvidence #
mkNonCanonical :: CtEvidence -> Ct #
CDictCan | |
| |
CIrredCan | |
| |
CTyEqCan | |
CFunEqCan | |
CNonCanonical | |
| |
CHoleCan | |
| |
CQuantCan QCInst |
data WantedConstraints #
Instances
Outputable WantedConstraints | |
Defined in Constraint ppr :: WantedConstraints -> SDoc # pprPrec :: Rational -> WantedConstraints -> SDoc # |
Predicate
classifyPredType :: PredType -> Pred #
A predicate in the solver. The solver tries to prove Wanted predicates from Given ones.
A choice of equality relation. This is separate from the type Role
because Phantom
does not define a (non-trivial) equality relation.
TcEvidence
evCast :: EvExpr -> TcCoercion -> EvTerm #
d |> co
type TcCoercion = Coercion #
type TcCoercionR = CoercionR #
Instances
Data EvTerm | |
Defined in TcEvidence gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EvTerm -> c EvTerm # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EvTerm # toConstr :: EvTerm -> Constr # dataTypeOf :: EvTerm -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EvTerm) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EvTerm) # gmapT :: (forall b. Data b => b -> b) -> EvTerm -> EvTerm # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EvTerm -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EvTerm -> r # gmapQ :: (forall d. Data d => d -> u) -> EvTerm -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EvTerm -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm # | |
Outputable EvTerm | |
TcPluginM
newFlexiTyVar :: Kind -> TcPluginM TcTyVar #
tcPluginTrace :: String -> SDoc -> TcPluginM () #
Output useful for debugging the compiler.
tcPluginIO :: IO a -> TcPluginM a #
Perform some IO, typically to interact with an external tool.
unsafeTcPluginTcM :: TcM a -> TcPluginM a #
TcRnTypes
TcPlugin | |
|
data TcPluginResult #
TcPluginContradiction [Ct] | The plugin found a contradiction. The returned constraints are removed from the inert set, and recorded as insoluble. |
TcPluginOk [(EvTerm, Ct)] [Ct] | The first field is for constraints that were solved. These are removed from the inert set, and the evidence for them is recorded. The second field contains new work, that should be processed by the constraint solver. |
TcType
tcGetTyVar_maybe :: Type -> Maybe TyVar #
isMetaTyVar :: TcTyVar -> Bool #
TyCoRep
TyVarTy Var | Vanilla type or kind variable (*never* a coercion variable) |
AppTy Type Type | Type application to something other than a 1) Function: must not be a 2) Argument type |
TyConApp TyCon [KindOrType] | Application of a 1) Type constructor being applied to. 2) Type arguments. Might not have enough type arguments here to saturate the constructor. Even type synonyms are not necessarily saturated; for example unsaturated type synonyms can appear as the right hand side of a type synonym. |
ForAllTy !TyCoVarBinder Type | A Π type. |
FunTy AnonArgFlag Type Type | t1 -> t2 Very common, so an important special case See Note [Function types] |
Instances
Data Type | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type # dataTypeOf :: Type -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) # gmapT :: (forall b. Data b => b -> b) -> Type -> Type # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # | |
Outputable Type | |
data UnivCoProvenance #
For simplicity, we have just one UnivCo that represents a coercion from
some type to some other type, with (in general) no restrictions on the
type. The UnivCoProvenance specifies more exactly what the coercion really
is and why a program should (or shouldn't!) trust the coercion.
It is reasonable to consider each constructor of UnivCoProvenance
as a totally independent coercion form; their only commonality is
that they don't tell you what types they coercion between. (That info
is in the UnivCo
constructor of Coercion
.
PluginProv String | From a plugin, which asserts that this coercion is sound. The string is for the use of the plugin. |
Instances
Data UnivCoProvenance | |
Defined in TyCoRep gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnivCoProvenance -> c UnivCoProvenance # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnivCoProvenance # toConstr :: UnivCoProvenance -> Constr # dataTypeOf :: UnivCoProvenance -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnivCoProvenance) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnivCoProvenance) # gmapT :: (forall b. Data b => b -> b) -> UnivCoProvenance -> UnivCoProvenance # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r # gmapQ :: (forall d. Data d => d -> u) -> UnivCoProvenance -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnivCoProvenance -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance # | |
Outputable UnivCoProvenance | |
Defined in TyCoRep ppr :: UnivCoProvenance -> SDoc # pprPrec :: Rational -> UnivCoProvenance -> SDoc # |
Unique
nonDetCmpUnique :: Unique -> Unique -> Ordering #
GHC.TcPluginM.Extra
tracePlugin :: String -> TcPlugin -> TcPlugin #
Print out extra information about the initialisation, stop, and every run
of the plugin when -ddump-tc-trace
is enabled.
:: ModuleName | Name of the module |
-> FastString | Name of the package containing the module. NOTE: This value is ignored on ghc>=8.0. |
-> TcPluginM Module |
Find a module
:: 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
TcTypeNats
GHC.Builtin.Types
naturalTyCon :: TyCon Source #
GHC
Haskell Module
All we actually declare here is the top-level structure for a module.
HsModule | |
|
Instances
Data (HsModule GhcPs) | |
Defined in GHC.Hs gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsModule GhcPs -> c (HsModule GhcPs) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsModule GhcPs) # toConstr :: HsModule GhcPs -> Constr # dataTypeOf :: HsModule GhcPs -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsModule GhcPs)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsModule GhcPs)) # gmapT :: (forall b. Data b => b -> b) -> HsModule GhcPs -> HsModule GhcPs # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsModule GhcPs -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsModule GhcPs -> r # gmapQ :: (forall d. Data d => d -> u) -> HsModule GhcPs -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsModule GhcPs -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsModule GhcPs -> m (HsModule GhcPs) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule GhcPs -> m (HsModule GhcPs) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule GhcPs -> m (HsModule GhcPs) # | |
Data (HsModule GhcRn) | |
Defined in GHC.Hs gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsModule GhcRn -> c (HsModule GhcRn) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsModule GhcRn) # toConstr :: HsModule GhcRn -> Constr # dataTypeOf :: HsModule GhcRn -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsModule GhcRn)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsModule GhcRn)) # gmapT :: (forall b. Data b => b -> b) -> HsModule GhcRn -> HsModule GhcRn # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsModule GhcRn -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsModule GhcRn -> r # gmapQ :: (forall d. Data d => d -> u) -> HsModule GhcRn -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsModule GhcRn -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsModule GhcRn -> m (HsModule GhcRn) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule GhcRn -> m (HsModule GhcRn) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule GhcRn -> m (HsModule GhcRn) # | |
Data (HsModule GhcTc) | |
Defined in GHC.Hs gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsModule GhcTc -> c (HsModule GhcTc) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HsModule GhcTc) # toConstr :: HsModule GhcTc -> Constr # dataTypeOf :: HsModule GhcTc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HsModule GhcTc)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HsModule GhcTc)) # gmapT :: (forall b. Data b => b -> b) -> HsModule GhcTc -> HsModule GhcTc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsModule GhcTc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsModule GhcTc -> r # gmapQ :: (forall d. Data d => d -> u) -> HsModule GhcTc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsModule GhcTc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsModule GhcTc -> m (HsModule GhcTc) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule GhcTc -> m (HsModule GhcTc) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsModule GhcTc -> m (HsModule GhcTc) # | |
OutputableBndrId p => Outputable (HsModule (GhcPass p)) | |
Instances
Eq Class | |
Data Class | |
Defined in Class gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Class -> c Class # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Class # dataTypeOf :: Class -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Class) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Class) # gmapT :: (forall b. Data b => b -> b) -> Class -> Class # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Class -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Class -> r # gmapQ :: (forall d. Data d => d -> u) -> Class -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Class -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Class -> m Class # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Class -> m Class # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Class -> m Class # | |
NamedThing Class | |
Uniquable Class | |
Outputable Class | |
HscTypes
data HsParsedModule #
IOEnv
readMutVar :: IORef a -> IOEnv env a #
writeMutVar :: IORef a -> a -> IOEnv env () #
Alternatives
tcLookupClass :: Name -> TcPluginM Class Source #
Deprecated: Use divulgeClass
instead
tcLookupTyCon :: Name -> TcPluginM TyCon Source #
Deprecated: Use divulgeTyCon
instead
lookupOrig :: Module -> OccName -> TcPluginM Name Source #
Deprecated: Use lookupName
instead