Safe Haskell | None |
---|---|
Language | Haskell2010 |
- Initialisation
- Simple accessors
- Arrow scopes
- Unique supply
- Accessing input/output
- Debugging
- Typechecker global environment
- Error management
- Usage environment
- Shared error message stuff: renamer and typechecker
- Context management for the type checker
- Error message generation (type checker)
- Type constraints
- Template Haskell context
- Safe Haskell context
- Stuff for the renamer's local env
- Stuff for interface decls
- Stuff for cost centres.
- Types etc.
- Orphan instances
Functions for working with the typechecker environment (setters, getters...).
Synopsis
- initTc :: HscEnv -> HscSource -> Bool -> Module -> RealSrcSpan -> TcM r -> IO (Messages DecoratedSDoc, Maybe r)
- initTcWithGbl :: HscEnv -> TcGblEnv -> RealSrcSpan -> TcM r -> IO (Messages DecoratedSDoc, Maybe r)
- initTcInteractive :: HscEnv -> TcM a -> IO (Messages DecoratedSDoc, Maybe a)
- initTcRnIf :: Char -> HscEnv -> gbl -> lcl -> TcRnIf gbl lcl a -> IO a
- discardResult :: TcM a -> TcM ()
- getTopEnv :: TcRnIf gbl lcl HscEnv
- updTopEnv :: (HscEnv -> HscEnv) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- getGblEnv :: TcRnIf gbl lcl gbl
- updGblEnv :: (gbl -> gbl) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- setGblEnv :: gbl -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- getLclEnv :: TcRnIf gbl lcl lcl
- updLclEnv :: (lcl -> lcl) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- setLclEnv :: lcl' -> TcRnIf gbl lcl' a -> TcRnIf gbl lcl a
- getEnvs :: TcRnIf gbl lcl (gbl, lcl)
- setEnvs :: (gbl', lcl') -> TcRnIf gbl' lcl' a -> TcRnIf gbl lcl a
- xoptM :: Extension -> TcRnIf gbl lcl Bool
- doptM :: DumpFlag -> TcRnIf gbl lcl Bool
- goptM :: GeneralFlag -> TcRnIf gbl lcl Bool
- woptM :: WarningFlag -> TcRnIf gbl lcl Bool
- setXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- whenDOptM :: DumpFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- whenWOptM :: WarningFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- whenXOptM :: Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- unlessXOptM :: Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- getGhcMode :: TcRnIf gbl lcl GhcMode
- withDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- withoutDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- getEpsVar :: TcRnIf gbl lcl (TcRef ExternalPackageState)
- getEps :: TcRnIf gbl lcl ExternalPackageState
- updateEps :: (ExternalPackageState -> (ExternalPackageState, a)) -> TcRnIf gbl lcl a
- updateEps_ :: (ExternalPackageState -> ExternalPackageState) -> TcRnIf gbl lcl ()
- getHpt :: TcRnIf gbl lcl HomePackageTable
- getEpsAndHpt :: TcRnIf gbl lcl (ExternalPackageState, HomePackageTable)
- newArrowScope :: TcM a -> TcM a
- escapeArrowScope :: TcM a -> TcM a
- newUnique :: TcRnIf gbl lcl Unique
- newUniqueSupply :: TcRnIf gbl lcl UniqSupply
- newName :: OccName -> TcM Name
- newNameAt :: OccName -> SrcSpan -> TcM Name
- cloneLocalName :: Name -> TcM Name
- newSysName :: OccName -> TcRnIf gbl lcl Name
- newSysLocalId :: FastString -> Mult -> TcType -> TcRnIf gbl lcl TcId
- newSysLocalIds :: FastString -> [Scaled TcType] -> TcRnIf gbl lcl [TcId]
- newTcRef :: a -> TcRnIf gbl lcl (TcRef a)
- readTcRef :: TcRef a -> TcRnIf gbl lcl a
- writeTcRef :: TcRef a -> a -> TcRnIf gbl lcl ()
- updTcRef :: TcRef a -> (a -> a) -> TcRnIf gbl lcl ()
- traceTc :: String -> SDoc -> TcRn ()
- traceRn :: String -> SDoc -> TcRn ()
- traceOptTcRn :: DumpFlag -> SDoc -> TcRn ()
- dumpOptTcRn :: DumpFlag -> String -> DumpFormat -> SDoc -> TcRn ()
- dumpTcRn :: Bool -> DumpFlag -> String -> DumpFormat -> SDoc -> TcRn ()
- getPrintUnqualified :: TcRn PrintUnqualified
- printForUserTcRn :: SDoc -> TcRn ()
- traceIf :: SDoc -> TcRnIf m n ()
- traceHiDiffs :: SDoc -> TcRnIf m n ()
- traceOptIf :: DumpFlag -> SDoc -> TcRnIf m n ()
- debugTc :: TcM () -> TcM ()
- getIsGHCi :: TcRn Bool
- getGHCiMonad :: TcRn Name
- getInteractivePrintName :: TcRn Name
- tcIsHsBootOrSig :: TcRn Bool
- tcIsHsig :: TcRn Bool
- tcSelfBootInfo :: TcRn SelfBootInfo
- getGlobalRdrEnv :: TcRn GlobalRdrEnv
- getRdrEnvs :: TcRn (GlobalRdrEnv, LocalRdrEnv)
- getImports :: TcRn ImportAvails
- getFixityEnv :: TcRn FixityEnv
- extendFixityEnv :: [(Name, FixItem)] -> RnM a -> RnM a
- getRecFieldEnv :: TcRn RecFieldEnv
- getDeclaredDefaultTys :: TcRn (Maybe [Type])
- addDependentFiles :: [FilePath] -> TcRn ()
- getSrcSpanM :: TcRn SrcSpan
- setSrcSpan :: SrcSpan -> TcRn a -> TcRn a
- addLocM :: (a -> TcM b) -> Located a -> TcM b
- inGeneratedCode :: TcRn Bool
- wrapLocM :: (a -> TcM b) -> Located a -> TcM (Located b)
- wrapLocFstM :: (a -> TcM (b, c)) -> Located a -> TcM (Located b, c)
- wrapLocSndM :: (a -> TcM (b, c)) -> Located a -> TcM (b, Located c)
- wrapLocM_ :: (a -> TcM ()) -> Located a -> TcM ()
- getErrsVar :: TcRn (TcRef (Messages DecoratedSDoc))
- setErrsVar :: TcRef (Messages DecoratedSDoc) -> TcRn a -> TcRn a
- addErr :: SDoc -> TcRn ()
- failWith :: SDoc -> TcRn a
- failAt :: SrcSpan -> SDoc -> TcRn a
- addErrAt :: SrcSpan -> SDoc -> TcRn ()
- addErrs :: [(SrcSpan, SDoc)] -> TcRn ()
- checkErr :: Bool -> SDoc -> TcRn ()
- addMessages :: Messages DecoratedSDoc -> TcRn ()
- discardWarnings :: TcRn a -> TcRn a
- tcCollectingUsage :: TcM a -> TcM (UsageEnv, a)
- tcScalingUsage :: Mult -> TcM a -> TcM a
- tcEmitBindingUsage :: UsageEnv -> TcM ()
- mkLongErrAt :: SrcSpan -> SDoc -> SDoc -> TcRn (MsgEnvelope DecoratedSDoc)
- mkDecoratedSDocAt :: SrcSpan -> SDoc -> SDoc -> SDoc -> TcRn (MsgEnvelope DecoratedSDoc)
- addLongErrAt :: SrcSpan -> SDoc -> SDoc -> TcRn ()
- reportErrors :: [MsgEnvelope DecoratedSDoc] -> TcM ()
- reportError :: MsgEnvelope DecoratedSDoc -> TcRn ()
- reportWarning :: WarnReason -> MsgEnvelope DecoratedSDoc -> TcRn ()
- recoverM :: TcRn r -> TcRn r -> TcRn r
- mapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b]
- mapAndReportM :: (a -> TcRn b) -> [a] -> TcRn [b]
- foldAndRecoverM :: (b -> a -> TcRn b) -> b -> [a] -> TcRn b
- attemptM :: TcRn r -> TcRn (Maybe r)
- tryTc :: TcRn a -> TcRn (Maybe a, Messages DecoratedSDoc)
- askNoErrs :: TcRn a -> TcRn (a, Bool)
- discardErrs :: TcRn a -> TcRn a
- tryTcDiscardingErrs :: TcM r -> TcM r -> TcM r
- checkNoErrs :: TcM r -> TcM r
- whenNoErrs :: TcM () -> TcM ()
- ifErrsM :: TcRn r -> TcRn r -> TcRn r
- failIfErrsM :: TcRn ()
- getErrCtxt :: TcM [ErrCtxt]
- setErrCtxt :: [ErrCtxt] -> TcM a -> TcM a
- addErrCtxt :: SDoc -> TcM a -> TcM a
- addErrCtxtM :: (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM a -> TcM a
- addLandmarkErrCtxt :: SDoc -> TcM a -> TcM a
- addLandmarkErrCtxtM :: (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM a -> TcM a
- popErrCtxt :: TcM a -> TcM a
- getCtLocM :: CtOrigin -> Maybe TypeOrKind -> TcM CtLoc
- setCtLocM :: CtLoc -> TcM a -> TcM a
- addErrTc :: SDoc -> TcM ()
- addErrTcM :: (TidyEnv, SDoc) -> TcM ()
- failWithTc :: SDoc -> TcM a
- failWithTcM :: (TidyEnv, SDoc) -> TcM a
- checkTc :: Bool -> SDoc -> TcM ()
- checkTcM :: Bool -> (TidyEnv, SDoc) -> TcM ()
- failIfTc :: Bool -> SDoc -> TcM ()
- failIfTcM :: Bool -> (TidyEnv, SDoc) -> TcM ()
- warnIfFlag :: WarningFlag -> Bool -> SDoc -> TcRn ()
- warnIf :: Bool -> SDoc -> TcRn ()
- warnTc :: WarnReason -> Bool -> SDoc -> TcM ()
- warnTcM :: WarnReason -> Bool -> (TidyEnv, SDoc) -> TcM ()
- addWarnTc :: WarnReason -> SDoc -> TcM ()
- addWarnTcM :: WarnReason -> (TidyEnv, SDoc) -> TcM ()
- addWarn :: WarnReason -> SDoc -> TcRn ()
- addWarnAt :: WarnReason -> SrcSpan -> SDoc -> TcRn ()
- add_warn :: WarnReason -> SDoc -> SDoc -> TcRn ()
- mkErrInfo :: TidyEnv -> [ErrCtxt] -> TcM SDoc
- newTcEvBinds :: TcM EvBindsVar
- newNoTcEvBinds :: TcM EvBindsVar
- cloneEvBindsVar :: EvBindsVar -> TcM EvBindsVar
- addTcEvBind :: EvBindsVar -> EvBind -> TcM ()
- addTopEvBinds :: Bag EvBind -> TcM a -> TcM a
- getTcEvTyCoVars :: EvBindsVar -> TcM TyCoVarSet
- getTcEvBindsMap :: EvBindsVar -> TcM EvBindMap
- setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcM ()
- chooseUniqueOccTc :: (OccSet -> OccName) -> TcM OccName
- getConstraintVar :: TcM (TcRef WantedConstraints)
- setConstraintVar :: TcRef WantedConstraints -> TcM a -> TcM a
- emitConstraints :: WantedConstraints -> TcM ()
- emitStaticConstraints :: WantedConstraints -> TcM ()
- emitSimple :: Ct -> TcM ()
- emitSimples :: Cts -> TcM ()
- emitImplication :: Implication -> TcM ()
- emitImplications :: Bag Implication -> TcM ()
- emitInsoluble :: Ct -> TcM ()
- emitHole :: Hole -> TcM ()
- emitHoles :: Bag Hole -> TcM ()
- discardConstraints :: TcM a -> TcM a
- captureConstraints :: TcM a -> TcM (a, WantedConstraints)
- tryCaptureConstraints :: TcM a -> TcM (Maybe a, WantedConstraints)
- pushLevelAndCaptureConstraints :: TcM a -> TcM (TcLevel, WantedConstraints, a)
- pushTcLevelM_ :: TcM a -> TcM a
- pushTcLevelM :: TcM a -> TcM (TcLevel, a)
- pushTcLevelsM :: Int -> TcM a -> TcM (a, TcLevel)
- getTcLevel :: TcM TcLevel
- setTcLevel :: TcLevel -> TcM a -> TcM a
- isTouchableTcM :: TcTyVar -> TcM Bool
- getLclTypeEnv :: TcM TcTypeEnv
- setLclTypeEnv :: TcLclEnv -> TcM a -> TcM a
- traceTcConstraints :: String -> TcM ()
- emitNamedTypeHole :: (Name, TcTyVar) -> TcM ()
- data IsExtraConstraint
- emitAnonTypeHole :: IsExtraConstraint -> TcTyVar -> TcM ()
- recordThUse :: TcM ()
- recordThSpliceUse :: TcM ()
- keepAlive :: Name -> TcRn ()
- getStage :: TcM ThStage
- getStageAndBindLevel :: Name -> TcRn (Maybe (TopLevelFlag, ThLevel, ThStage))
- setStage :: ThStage -> TcM a -> TcRn a
- addModFinalizersWithLclEnv :: ThModFinalizers -> TcM ()
- recordUnsafeInfer :: WarningMessages -> TcM ()
- finalSafeMode :: DynFlags -> TcGblEnv -> IO SafeHaskellMode
- fixSafeInstances :: SafeHaskellMode -> [ClsInst] -> [ClsInst]
- getLocalRdrEnv :: RnM LocalRdrEnv
- setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a
- mkIfLclEnv :: Module -> SDoc -> IsBootInterface -> IfLclEnv
- initIfaceTcRn :: IfG a -> TcRn a
- initIfaceCheck :: SDoc -> HscEnv -> IfG a -> IO a
- initIfaceLcl :: Module -> SDoc -> IsBootInterface -> IfL a -> IfM lcl a
- initIfaceLclWithSubst :: Module -> SDoc -> IsBootInterface -> NameShape -> IfL a -> IfM lcl a
- initIfaceLoad :: HscEnv -> IfG a -> IO a
- getIfModule :: IfL Module
- failIfM :: SDoc -> IfL a
- forkM_maybe :: SDoc -> IfL a -> IfL (Maybe a)
- forkM :: SDoc -> IfL a -> IfL a
- setImplicitEnvM :: TypeEnv -> IfL a -> IfL a
- withException :: TcRnIf gbl lcl (MaybeErr SDoc a) -> TcRnIf gbl lcl a
- getCCIndexM :: (gbl -> TcRef CostCentreState) -> FastString -> TcRnIf gbl lcl CostCentreIndex
- getCCIndexTcM :: FastString -> TcM CostCentreIndex
Initialisation
initTc :: HscEnv -> HscSource -> Bool -> Module -> RealSrcSpan -> TcM r -> IO (Messages DecoratedSDoc, Maybe r) Source #
Setup the initial typechecking environment
initTcWithGbl :: HscEnv -> TcGblEnv -> RealSrcSpan -> TcM r -> IO (Messages DecoratedSDoc, Maybe r) Source #
Run a TcM
action in the context of an existing GblEnv
.
Simple accessors
discardResult :: TcM a -> TcM () Source #
goptM :: GeneralFlag -> TcRnIf gbl lcl Bool Source #
unsetXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () Source #
unlessXOptM :: Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () Source #
getGhcMode :: TcRnIf gbl lcl GhcMode Source #
withDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
withoutDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
updateEps :: (ExternalPackageState -> (ExternalPackageState, a)) -> TcRnIf gbl lcl a Source #
Update the external package state. Returns the second result of the modifier function.
This is an atomic operation and forces evaluation of the modified EPS in order to avoid space leaks.
updateEps_ :: (ExternalPackageState -> ExternalPackageState) -> TcRnIf gbl lcl () Source #
Update the external package state.
This is an atomic operation and forces evaluation of the modified EPS in order to avoid space leaks.
getEpsAndHpt :: TcRnIf gbl lcl (ExternalPackageState, HomePackageTable) Source #
Arrow scopes
newArrowScope :: TcM a -> TcM a Source #
escapeArrowScope :: TcM a -> TcM a Source #
Unique supply
newUniqueSupply :: TcRnIf gbl lcl UniqSupply Source #
cloneLocalName :: Name -> TcM Name Source #
newSysName :: OccName -> TcRnIf gbl lcl Name Source #
Accessing input/output
writeTcRef :: TcRef a -> a -> TcRnIf gbl lcl () Source #
Debugging
traceOptTcRn :: DumpFlag -> SDoc -> TcRn () Source #
dumpOptTcRn :: DumpFlag -> String -> DumpFormat -> SDoc -> TcRn () Source #
Dump if the given DumpFlag
is set.
dumpTcRn :: Bool -> DumpFlag -> String -> DumpFormat -> SDoc -> TcRn () Source #
Unconditionally dump some trace output
Certain tests (T3017, Roles3, T12763 etc.) expect part of the
output generated by `-ddump-types` to be in PprUser
style. However,
generally we want all other debugging output to use PprDump
style. We PprUser
style if useUserStyle
is True.
getPrintUnqualified :: TcRn PrintUnqualified Source #
printForUserTcRn :: SDoc -> TcRn () Source #
Like logInfoTcRn, but for user consumption
traceHiDiffs :: SDoc -> TcRnIf m n () Source #
traceOptIf :: DumpFlag -> SDoc -> TcRnIf m n () Source #
Typechecker global environment
getGHCiMonad :: TcRn Name Source #
getInteractivePrintName :: TcRn Name Source #
tcIsHsBootOrSig :: TcRn Bool Source #
tcSelfBootInfo :: TcRn SelfBootInfo Source #
getGlobalRdrEnv :: TcRn GlobalRdrEnv Source #
getRdrEnvs :: TcRn (GlobalRdrEnv, LocalRdrEnv) Source #
getImports :: TcRn ImportAvails Source #
getFixityEnv :: TcRn FixityEnv Source #
extendFixityEnv :: [(Name, FixItem)] -> RnM a -> RnM a Source #
getRecFieldEnv :: TcRn RecFieldEnv Source #
getDeclaredDefaultTys :: TcRn (Maybe [Type]) Source #
addDependentFiles :: [FilePath] -> TcRn () Source #
Error management
getSrcSpanM :: TcRn SrcSpan Source #
setSrcSpan :: SrcSpan -> TcRn a -> TcRn a Source #
inGeneratedCode :: TcRn Bool Source #
wrapLocFstM :: (a -> TcM (b, c)) -> Located a -> TcM (Located b, c) Source #
wrapLocSndM :: (a -> TcM (b, c)) -> Located a -> TcM (b, Located c) Source #
getErrsVar :: TcRn (TcRef (Messages DecoratedSDoc)) Source #
setErrsVar :: TcRef (Messages DecoratedSDoc) -> TcRn a -> TcRn a Source #
addMessages :: Messages DecoratedSDoc -> TcRn () Source #
discardWarnings :: TcRn a -> TcRn a Source #
Usage environment
tcCollectingUsage :: TcM a -> TcM (UsageEnv, a) Source #
tcCollectingUsage thing_inside
runs thing_inside
and returns the usage
information which was collected as part of the execution of
thing_inside
. Careful: tcCollectingUsage thing_inside
itself does not
report any usage information, it's up to the caller to incorporate the
returned usage information into the larger context appropriately.
tcScalingUsage :: Mult -> TcM a -> TcM a Source #
tcScalingUsage mult thing_inside
runs thing_inside
and scales all the
usage information by mult
.
tcEmitBindingUsage :: UsageEnv -> TcM () Source #
Shared error message stuff: renamer and typechecker
mkLongErrAt :: SrcSpan -> SDoc -> SDoc -> TcRn (MsgEnvelope DecoratedSDoc) Source #
:: SrcSpan | |
-> SDoc | The important part of the message |
-> SDoc | The context of the message |
-> SDoc | Any supplementary information. |
-> TcRn (MsgEnvelope DecoratedSDoc) |
addLongErrAt :: SrcSpan -> SDoc -> SDoc -> TcRn () Source #
reportErrors :: [MsgEnvelope DecoratedSDoc] -> TcM () Source #
reportError :: MsgEnvelope DecoratedSDoc -> TcRn () Source #
reportWarning :: WarnReason -> MsgEnvelope DecoratedSDoc -> TcRn () Source #
mapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b] Source #
Drop elements of the input that fail, so the result list can be shorter than the argument list
mapAndReportM :: (a -> TcRn b) -> [a] -> TcRn [b] Source #
Apply the function to all elements on the input list If all succeed, return the list of results Otherwise fail, propagating all errors
foldAndRecoverM :: (b -> a -> TcRn b) -> b -> [a] -> TcRn b Source #
The accumulator is not updated if the action fails
discardErrs :: TcRn a -> TcRn a Source #
tryTcDiscardingErrs :: TcM r -> TcM r -> TcM r Source #
checkNoErrs :: TcM r -> TcM r Source #
whenNoErrs :: TcM () -> TcM () Source #
failIfErrsM :: TcRn () Source #
Context management for the type checker
getErrCtxt :: TcM [ErrCtxt] Source #
setErrCtxt :: [ErrCtxt] -> TcM a -> TcM a Source #
addErrCtxt :: SDoc -> TcM a -> TcM a Source #
Add a fixed message to the error context. This message should not do any tidying.
addErrCtxtM :: (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM a -> TcM a Source #
Add a message to the error context. This message may do tidying.
addLandmarkErrCtxt :: SDoc -> TcM a -> TcM a Source #
Add a fixed landmark message to the error context. A landmark message is always sure to be reported, even if there is a lot of context. It also doesn't count toward the maximum number of contexts reported.
addLandmarkErrCtxtM :: (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM a -> TcM a Source #
Variant of addLandmarkErrCtxt
that allows for monadic operations
and tidying.
popErrCtxt :: TcM a -> TcM a Source #
Error message generation (type checker)
failWithTc :: SDoc -> TcM a Source #
failWithTcM :: (TidyEnv, SDoc) -> TcM a Source #
warnIfFlag :: WarningFlag -> Bool -> SDoc -> TcRn () Source #
Display a warning if a condition is met, and the warning is enabled
warnTcM :: WarnReason -> Bool -> (TidyEnv, SDoc) -> TcM () Source #
Display a warning if a condition is met.
addWarnTcM :: WarnReason -> (TidyEnv, SDoc) -> TcM () Source #
Display a warning in a given context.
addWarnAt :: WarnReason -> SrcSpan -> SDoc -> TcRn () Source #
Display a warning for a given source location.
add_warn :: WarnReason -> SDoc -> SDoc -> TcRn () Source #
Display a warning, with an optional flag, for the current source location.
Type constraints
newTcEvBinds :: TcM EvBindsVar Source #
newNoTcEvBinds :: TcM EvBindsVar Source #
Creates an EvBindsVar incapable of holding any bindings. It still tracks covar usages (see comments on ebv_tcvs in GHC.Tc.Types.Evidence), thus must be made monadically
cloneEvBindsVar :: EvBindsVar -> TcM EvBindsVar Source #
addTcEvBind :: EvBindsVar -> EvBind -> TcM () Source #
addTopEvBinds :: Bag EvBind -> TcM a -> TcM a Source #
getTcEvTyCoVars :: EvBindsVar -> TcM TyCoVarSet Source #
getTcEvBindsMap :: EvBindsVar -> TcM EvBindMap Source #
setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcM () Source #
getConstraintVar :: TcM (TcRef WantedConstraints) Source #
setConstraintVar :: TcRef WantedConstraints -> TcM a -> TcM a Source #
emitConstraints :: WantedConstraints -> TcM () Source #
emitStaticConstraints :: WantedConstraints -> TcM () Source #
emitSimple :: Ct -> TcM () Source #
emitSimples :: Cts -> TcM () Source #
emitImplication :: Implication -> TcM () Source #
emitImplications :: Bag Implication -> TcM () Source #
emitInsoluble :: Ct -> TcM () Source #
discardConstraints :: TcM a -> TcM a Source #
Throw out any constraints emitted by the thing_inside
captureConstraints :: TcM a -> TcM (a, WantedConstraints) Source #
tryCaptureConstraints :: TcM a -> TcM (Maybe a, WantedConstraints) Source #
pushLevelAndCaptureConstraints :: TcM a -> TcM (TcLevel, WantedConstraints, a) Source #
The name says it all. The returned TcLevel is the *inner* TcLevel.
pushTcLevelM_ :: TcM a -> TcM a Source #
pushTcLevelM :: TcM a -> TcM (TcLevel, a) Source #
pushTcLevelsM :: Int -> TcM a -> TcM (a, TcLevel) Source #
getTcLevel :: TcM TcLevel Source #
setTcLevel :: TcLevel -> TcM a -> TcM a Source #
isTouchableTcM :: TcTyVar -> TcM Bool Source #
getLclTypeEnv :: TcM TcTypeEnv Source #
setLclTypeEnv :: TcLclEnv -> TcM a -> TcM a Source #
traceTcConstraints :: String -> TcM () Source #
emitNamedTypeHole :: (Name, TcTyVar) -> TcM () Source #
data IsExtraConstraint Source #
Instances
Outputable IsExtraConstraint Source # | |
Defined in GHC.Tc.Utils.Monad ppr :: IsExtraConstraint -> SDoc |
emitAnonTypeHole :: IsExtraConstraint -> TcTyVar -> TcM () Source #
Template Haskell context
recordThUse :: TcM () Source #
recordThSpliceUse :: TcM () Source #
getStageAndBindLevel :: Name -> TcRn (Maybe (TopLevelFlag, ThLevel, ThStage)) Source #
addModFinalizersWithLclEnv :: ThModFinalizers -> TcM () Source #
Adds the given modFinalizers to the global environment and set them to use the current local environment.
Safe Haskell context
recordUnsafeInfer :: WarningMessages -> TcM () Source #
Mark that safe inference has failed See Note [Safe Haskell Overlapping Instances Implementation] although this is used for more than just that failure case.
finalSafeMode :: DynFlags -> TcGblEnv -> IO SafeHaskellMode Source #
Figure out the final correct safe haskell mode
fixSafeInstances :: SafeHaskellMode -> [ClsInst] -> [ClsInst] Source #
Switch instances to safe instances if we're in Safe mode.
Stuff for the renamer's local env
getLocalRdrEnv :: RnM LocalRdrEnv Source #
setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a Source #
Stuff for interface decls
mkIfLclEnv :: Module -> SDoc -> IsBootInterface -> IfLclEnv Source #
initIfaceTcRn :: IfG a -> TcRn a Source #
Run an IfG
(top-level interface monad) computation inside an existing
TcRn
(typecheck-renaming monad) computation by initializing an IfGblEnv
based on TcGblEnv
.
initIfaceCheck :: SDoc -> HscEnv -> IfG a -> IO a Source #
initIfaceLcl :: Module -> SDoc -> IsBootInterface -> IfL a -> IfM lcl a Source #
initIfaceLclWithSubst :: Module -> SDoc -> IsBootInterface -> NameShape -> IfL a -> IfM lcl a Source #
initIfaceLoad :: HscEnv -> IfG a -> IO a Source #
getIfModule :: IfL Module Source #
forkM_maybe :: SDoc -> IfL a -> IfL (Maybe a) Source #
Run thing_inside in an interleaved thread. It shares everything with the parent thread, so this is DANGEROUS.
It returns Nothing if the computation fails
It's used for lazily type-checking interface signatures, which is pretty benign.
See Note [Masking exceptions in forkM_maybe]
setImplicitEnvM :: TypeEnv -> IfL a -> IfL a Source #
withException :: TcRnIf gbl lcl (MaybeErr SDoc a) -> TcRnIf gbl lcl a Source #
A convenient wrapper for taking a MaybeErr SDoc a
and throwing
an exception if it is an error.
Stuff for cost centres.
getCCIndexM :: (gbl -> TcRef CostCentreState) -> FastString -> TcRnIf gbl lcl CostCentreIndex Source #
Get the next cost centre index associated with a given name.
getCCIndexTcM :: FastString -> TcM CostCentreIndex Source #
See getCCIndexM
.
Types etc.
Orphan instances
MonadUnique (IOEnv (Env gbl lcl)) Source # | |
getUniqueSupplyM :: IOEnv (Env gbl lcl) UniqSupply # getUniqueM :: IOEnv (Env gbl lcl) Unique # getUniquesM :: IOEnv (Env gbl lcl) [Unique] # |