Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type TcRnIf a b = IOEnv (Env a b)
- type TcRn = TcRnIf TcGblEnv TcLclEnv
- type TcM = TcRn
- type RnM = TcRn
- type IfM lcl = TcRnIf IfGblEnv lcl
- type IfL = IfM IfLclEnv
- type IfG = IfM ()
- type TcRef a = IORef a
- data Env gbl lcl = Env {}
- data TcGblEnv = TcGblEnv {
- tcg_mod :: Module
- tcg_semantic_mod :: Module
- tcg_src :: HscSource
- tcg_rdr_env :: GlobalRdrEnv
- tcg_default :: Maybe [Type]
- tcg_fix_env :: FixityEnv
- tcg_field_env :: RecFieldEnv
- tcg_type_env :: TypeEnv
- tcg_type_env_var :: TcRef TypeEnv
- tcg_inst_env :: !InstEnv
- tcg_fam_inst_env :: !FamInstEnv
- tcg_ann_env :: AnnEnv
- tcg_exports :: [AvailInfo]
- tcg_imports :: ImportAvails
- tcg_dus :: DefUses
- tcg_used_gres :: TcRef [GlobalRdrElt]
- tcg_keep :: TcRef NameSet
- tcg_th_used :: TcRef Bool
- tcg_th_splice_used :: TcRef Bool
- tcg_th_top_level_locs :: TcRef (Set RealSrcSpan)
- tcg_dfun_n :: TcRef OccSet
- tcg_merged :: [(Module, Fingerprint)]
- tcg_rn_exports :: Maybe [(Located (IE GhcRn), Avails)]
- tcg_rn_imports :: [LImportDecl GhcRn]
- tcg_rn_decls :: Maybe (HsGroup GhcRn)
- tcg_dependent_files :: TcRef [FilePath]
- tcg_th_topdecls :: TcRef [LHsDecl GhcPs]
- tcg_th_foreign_files :: TcRef [(ForeignSrcLang, FilePath)]
- tcg_th_topnames :: TcRef NameSet
- tcg_th_modfinalizers :: TcRef [(TcLclEnv, ThModFinalizers)]
- tcg_th_coreplugins :: TcRef [String]
- tcg_th_state :: TcRef (Map TypeRep Dynamic)
- tcg_th_remote_state :: TcRef (Maybe (ForeignRef (IORef QState)))
- tcg_ev_binds :: Bag EvBind
- tcg_tr_module :: Maybe Id
- tcg_binds :: LHsBinds GhcTc
- tcg_sigs :: NameSet
- tcg_imp_specs :: [LTcSpecPrag]
- tcg_warns :: Warnings
- tcg_anns :: [Annotation]
- tcg_tcs :: [TyCon]
- tcg_insts :: [ClsInst]
- tcg_fam_insts :: [FamInst]
- tcg_rules :: [LRuleDecl GhcTc]
- tcg_fords :: [LForeignDecl GhcTc]
- tcg_patsyns :: [PatSyn]
- tcg_doc_hdr :: Maybe LHsDocString
- tcg_hpc :: !AnyHpcUsage
- tcg_self_boot :: SelfBootInfo
- tcg_main :: Maybe Name
- tcg_safeInfer :: TcRef (Bool, WarningMessages)
- tcg_tc_plugins :: [TcPluginSolver]
- tcg_hf_plugins :: [HoleFitPlugin]
- tcg_top_loc :: RealSrcSpan
- tcg_static_wc :: TcRef WantedConstraints
- tcg_complete_matches :: [CompleteMatch]
- tcg_cc_st :: TcRef CostCentreState
- data TcLclEnv = TcLclEnv {
- tcl_loc :: RealSrcSpan
- tcl_ctxt :: [ErrCtxt]
- tcl_tclvl :: TcLevel
- tcl_th_ctxt :: ThStage
- tcl_th_bndrs :: ThBindEnv
- tcl_arrow_ctxt :: ArrowCtxt
- tcl_rdr :: LocalRdrEnv
- tcl_env :: TcTypeEnv
- tcl_bndrs :: TcBinderStack
- tcl_lie :: TcRef WantedConstraints
- tcl_errs :: TcRef Messages
- setLclEnvTcLevel :: TcLclEnv -> TcLevel -> TcLclEnv
- getLclEnvTcLevel :: TcLclEnv -> TcLevel
- setLclEnvLoc :: TcLclEnv -> RealSrcSpan -> TcLclEnv
- getLclEnvLoc :: TcLclEnv -> RealSrcSpan
- data IfGblEnv = IfGblEnv {}
- data IfLclEnv = IfLclEnv {}
- tcVisibleOrphanMods :: TcGblEnv -> ModuleSet
- data FrontendResult = FrontendTypecheck TcGblEnv
- type ErrCtxt = (Bool, TidyEnv -> TcM (TidyEnv, MsgDoc))
- type RecFieldEnv = NameEnv [FieldLabel]
- pushErrCtxt :: CtOrigin -> ErrCtxt -> CtLoc -> CtLoc
- pushErrCtxtSameOrigin :: ErrCtxt -> CtLoc -> CtLoc
- data ImportAvails = ImportAvails {}
- emptyImportAvails :: ImportAvails
- plusImportAvails :: ImportAvails -> ImportAvails -> ImportAvails
- data WhereFrom
- mkModDeps :: [(ModuleName, IsBootInterface)] -> ModuleNameEnv (ModuleName, IsBootInterface)
- modDepsElts :: ModuleNameEnv (ModuleName, IsBootInterface) -> [(ModuleName, IsBootInterface)]
- type TcTypeEnv = NameEnv TcTyThing
- type TcBinderStack = [TcBinder]
- data TcBinder
- data TcTyThing
- = AGlobal TyThing
- | ATcId {
- tct_id :: TcId
- tct_info :: IdBindingInfo
- | ATyVar Name TcTyVar
- | ATcTyCon TyCon
- | APromotionErr PromotionErr
- data PromotionErr
- data IdBindingInfo
- type ClosedTypeId = Bool
- type RhsNames = NameSet
- data IsGroupClosed = IsGroupClosed (NameEnv RhsNames) ClosedTypeId
- data SelfBootInfo
- = NoSelfBoot
- | SelfBoot {
- sb_mds :: ModDetails
- sb_tcs :: NameSet
- pprTcTyThingCategory :: TcTyThing -> SDoc
- pprPECategory :: PromotionErr -> SDoc
- data CompleteMatch = CompleteMatch {}
- type DsM = TcRnIf DsGblEnv DsLclEnv
- data DsLclEnv = DsLclEnv {}
- data DsGblEnv = DsGblEnv {}
- type DsMetaEnv = NameEnv DsMetaVal
- data DsMetaVal
- type CompleteMatchMap = UniqFM [CompleteMatch]
- mkCompleteMatchMap :: [CompleteMatch] -> CompleteMatchMap
- extendCompleteMatchMap :: CompleteMatchMap -> [CompleteMatch] -> CompleteMatchMap
- data ThStage
- = Splice SpliceType
- | RunSplice (TcRef [ForeignRef (Q ())])
- | Comp
- | Brack ThStage PendingStuff
- data SpliceType
- data PendingStuff
- topStage :: ThStage
- topAnnStage :: ThStage
- topSpliceStage :: ThStage
- type ThLevel = Int
- impLevel :: ThLevel
- outerLevel :: ThLevel
- thLevel :: ThStage -> ThLevel
- data ForeignSrcLang
- data ArrowCtxt
- type TcSigFun = Name -> Maybe TcSigInfo
- data TcSigInfo
- data TcIdSigInfo
- = CompleteSig { }
- | PartialSig { }
- data TcIdSigInst = TISI {
- sig_inst_sig :: TcIdSigInfo
- sig_inst_skols :: [(Name, TcTyVar)]
- sig_inst_theta :: TcThetaType
- sig_inst_tau :: TcSigmaType
- sig_inst_wcs :: [(Name, TcTyVar)]
- sig_inst_wcx :: Maybe TcType
- data TcPatSynInfo = TPSI {}
- isPartialSig :: TcIdSigInst -> Bool
- hasCompleteSig :: TcSigFun -> Name -> Bool
- type TcId = Id
- type TcIdSet = IdSet
- data Hole
- holeOcc :: Hole -> OccName
- data NameShape = NameShape {
- ns_mod_name :: ModuleName
- ns_exports :: [AvailInfo]
- ns_map :: OccEnv Name
- removeBindingShadowing :: HasOccName a => [a] -> [a]
- data TcPlugin = forall s. TcPlugin {
- tcPluginInit :: TcPluginM s
- tcPluginSolve :: s -> TcPluginSolver
- tcPluginStop :: s -> TcPluginM ()
- data TcPluginResult
- = TcPluginContradiction [Ct]
- | TcPluginOk [(EvTerm, Ct)] [Ct]
- type TcPluginSolver = [Ct] -> [Ct] -> [Ct] -> TcPluginM TcPluginResult
- data TcPluginM a
- runTcPluginM :: TcPluginM a -> EvBindsVar -> TcM a
- unsafeTcPluginTcM :: TcM a -> TcPluginM a
- getEvBindsTcPluginM :: TcPluginM EvBindsVar
- type RoleAnnotEnv = NameEnv (LRoleAnnotDecl GhcRn)
- emptyRoleAnnotEnv :: RoleAnnotEnv
- mkRoleAnnotEnv :: [LRoleAnnotDecl GhcRn] -> RoleAnnotEnv
- lookupRoleAnnot :: RoleAnnotEnv -> Name -> Maybe (LRoleAnnotDecl GhcRn)
- getRoleAnnots :: [Name] -> RoleAnnotEnv -> [LRoleAnnotDecl GhcRn]
Documentation
Instances
TcGblEnv
describes the top-level of the module at the
point at which the typechecker is finished work.
It is this structure that is handed on to the desugarer
For state that needs to be updated during the typechecking
phase and returned at end, use a TcRef
(= IORef
).
TcGblEnv | |
|
Instances
TcLclEnv | |
|
Instances
getLclEnvTcLevel :: TcLclEnv -> TcLevel Source #
setLclEnvLoc :: TcLclEnv -> RealSrcSpan -> TcLclEnv Source #
getLclEnvLoc :: TcLclEnv -> RealSrcSpan Source #
data FrontendResult Source #
FrontendResult
describes the result of running the
frontend of a Haskell module. Usually, you'll get
a FrontendTypecheck
, since running the frontend involves
typechecking a program, but for an hs-boot merge you'll
just get a ModIface, since no actual typechecking occurred.
This data type really should be in HscTypes, but it needs to have a TcGblEnv which is only defined here.
type RecFieldEnv = NameEnv [FieldLabel] Source #
data ImportAvails Source #
ImportAvails
summarises what was imported from where, irrespective of
whether the imported things are actually used or not. It is used:
- when processing the export list,
- when constructing usage info for the interface file,
- to identify the list of directly imported modules for initialisation purposes and for optimised overlap checking of family instances,
- when figuring out what things are really unused
ImportAvails | |
|
plusImportAvails :: ImportAvails -> ImportAvails -> ImportAvails Source #
Union two ImportAvails
This function is a key part of Import handling, basically for each import we create a separate ImportAvails structure and then union them all together with this function.
mkModDeps :: [(ModuleName, IsBootInterface)] -> ModuleNameEnv (ModuleName, IsBootInterface) Source #
modDepsElts :: ModuleNameEnv (ModuleName, IsBootInterface) -> [(ModuleName, IsBootInterface)] Source #
type TcBinderStack = [TcBinder] Source #
A typecheckable thing available in a local context. Could be
AGlobal
TyThing
, but also lexically scoped variables, etc.
See TcEnv
for how to retrieve a TyThing
given a Name
.
data PromotionErr Source #
TyConPE | |
ClassPE | |
FamDataConPE | |
ConstrainedDataConPE PredType | |
PatSynPE | |
RecDataConPE | |
NoDataKindsTC | |
NoDataKindsDC |
Instances
data IdBindingInfo Source #
IdBindingInfo describes how an Id is bound.
It is used for the following purposes: a) for static forms in TcExpr.checkClosedInStaticForm and b) to figure out when a nested binding can be generalised, in TcBinds.decideGeneralisationPlan.
Instances
type ClosedTypeId = Bool Source #
data IsGroupClosed Source #
IsGroupClosed describes a group of mutually-recursive bindings
data SelfBootInfo Source #
pprTcTyThingCategory :: TcTyThing -> SDoc Source #
pprPECategory :: PromotionErr -> SDoc Source #
data CompleteMatch Source #
A list of conlikes which represents a complete pattern match.
These arise from COMPLETE
signatures.
CompleteMatch | |
|
Instances
Instances
ContainsModule DsGblEnv # | |
ContainsCostCentreState DsGblEnv # | |
Defined in TcRnMonad | |
MonadThings (IOEnv (Env DsGblEnv DsLclEnv)) # | |
type CompleteMatchMap = UniqFM [CompleteMatch] Source #
A map keyed by the completeMatchTyCon
.
Splice SpliceType | |
RunSplice (TcRef [ForeignRef (Q ())]) | |
Comp | |
Brack ThStage PendingStuff |
data SpliceType Source #
data PendingStuff Source #
outerLevel :: ThLevel Source #
data ForeignSrcLang Source #
Foreign formats supported by GHC via TH
LangC | C |
LangCxx | C++ |
LangObjc | Objective C |
LangObjcxx | Objective C++ |
LangAsm | Assembly language (.s) |
RawObject | Object (.o) |
Instances
Eq ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type (==) :: ForeignSrcLang -> ForeignSrcLang -> Bool # (/=) :: ForeignSrcLang -> ForeignSrcLang -> Bool # | |
Show ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type | |
Generic ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type from :: ForeignSrcLang -> Rep ForeignSrcLang x Source # to :: Rep ForeignSrcLang x -> ForeignSrcLang Source # | |
type Rep ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type type Rep ForeignSrcLang = D1 ('MetaData "ForeignSrcLang" "GHC.ForeignSrcLang.Type" "ghc-boot-th-8.10.2" 'False) ((C1 ('MetaCons "LangC" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LangCxx" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LangObjc" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LangObjcxx" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LangAsm" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RawObject" 'PrefixI 'False) (U1 :: Type -> Type)))) |
data TcIdSigInfo Source #
CompleteSig | |
PartialSig | |
|
Instances
data TcIdSigInst Source #
TISI | |
|
Instances
data TcPatSynInfo Source #
TPSI | |
|
Instances
isPartialSig :: TcIdSigInst -> Bool Source #
An expression or type hole
ExprHole UnboundVar | Either an out-of-scope variable or a "true" hole in an expression (TypedHoles) |
TypeHole OccName | A hole in a type (PartialTypeSignatures) |
A NameShape
is a substitution on Name
s that can be used
to refine the identities of a hole while we are renaming interfaces
(see RnModIface
). Specifically, a NameShape
for
ns_module_name
A
, defines a mapping from {A.T}
(for some OccName
T
) to some arbitrary other Name
.
The most intruiging thing about a NameShape
, however, is
how it's constructed. A NameShape
is *implied* by the
exported AvailInfo
s of the implementor of an interface:
if an implementor of signature H
exports M.T
, you implicitly
define a substitution from {H.T}
to M.T
. So a NameShape
is computed from the list of AvailInfo
s that are exported
by the implementation of a module, or successively merged
together by the export lists of signatures which are joining
together.
It's not the most obvious way to go about doing this, but it does seem to work!
NB: Can't boot this and put it in NameShape because then we start pulling in too many DynFlags things.
NameShape | |
|
removeBindingShadowing :: HasOccName a => [a] -> [a] Source #
forall s. TcPlugin | |
|
data TcPluginResult Source #
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. |
type TcPluginSolver = [Ct] -> [Ct] -> [Ct] -> TcPluginM TcPluginResult Source #
runTcPluginM :: TcPluginM a -> EvBindsVar -> TcM a Source #
unsafeTcPluginTcM :: TcM a -> TcPluginM a Source #
getEvBindsTcPluginM :: TcPluginM EvBindsVar Source #
Access the EvBindsVar
carried by the TcPluginM
during
constraint solving. Returns Nothing
if invoked during
tcPluginInit
or tcPluginStop
.
type RoleAnnotEnv = NameEnv (LRoleAnnotDecl GhcRn) Source #
mkRoleAnnotEnv :: [LRoleAnnotDecl GhcRn] -> RoleAnnotEnv Source #
lookupRoleAnnot :: RoleAnnotEnv -> Name -> Maybe (LRoleAnnotDecl GhcRn) Source #
getRoleAnnots :: [Name] -> RoleAnnotEnv -> [LRoleAnnotDecl GhcRn] Source #