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
- Diagnostic 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.
- Zonking
- Types etc.
- Orphan instances
Functions for working with the typechecker environment (setters, getters...).
Synopsis
- initTc :: HscEnv -> HscSource -> Bool -> Module -> RealSrcSpan -> TcM r -> IO (Messages TcRnMessage, Maybe r)
- initTcWithGbl :: HscEnv -> TcGblEnv -> RealSrcSpan -> TcM r -> IO (Messages TcRnMessage, Maybe r)
- initTcInteractive :: HscEnv -> TcM a -> IO (Messages TcRnMessage, 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
- updLclCtxt :: (TcLclCtxt -> TcLclCtxt) -> TcRnIf gbl TcLclEnv a -> TcRnIf gbl TcLclEnv a
- setLclEnv :: lcl' -> TcRnIf gbl lcl' a -> TcRnIf gbl lcl a
- restoreLclEnv :: TcLclEnv -> TcRnIf gbl TcLclEnv a -> TcRnIf gbl TcLclEnv a
- updTopFlags :: (DynFlags -> DynFlags) -> 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
- updEnvs :: ((gbl, lcl) -> (gbl, lcl)) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- restoreEnvs :: (TcGblEnv, TcLclEnv) -> TcRn a -> TcRn 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
- 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
- getEpsAndHug :: TcRnIf gbl lcl (ExternalPackageState, HomeUnitGraph)
- 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 :: MonadIO m => a -> m (TcRef a)
- readTcRef :: MonadIO m => TcRef a -> m a
- writeTcRef :: MonadIO m => TcRef a -> a -> m ()
- updTcRef :: MonadIO m => TcRef a -> (a -> a) -> m ()
- updTcRefM :: MonadIO m => TcRef a -> (a -> m a) -> m ()
- 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 ()
- getNamePprCtx :: TcRn NamePprCtx
- printForUserTcRn :: SDoc -> TcRn ()
- traceIf :: SDoc -> TcRnIf m n ()
- traceOptIf :: DumpFlag -> SDoc -> TcRnIf m n ()
- debugTc :: TcM () -> TcM ()
- getIsGHCi :: TcRn Bool
- getGHCiMonad :: TcRn Name
- getInteractivePrintName :: TcRn Name
- tcHscSource :: TcRn HscSource
- 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
- getDeclaredDefaultTys :: TcRn (Maybe [Type])
- addDependentFiles :: [FilePath] -> TcRn ()
- getSrcSpanM :: TcRn SrcSpan
- setSrcSpan :: SrcSpan -> TcRn a -> TcRn a
- setSrcSpanA :: SrcSpanAnn' ann -> TcRn a -> TcRn a
- addLocM :: (a -> TcM b) -> Located a -> TcM b
- addLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcM b
- inGeneratedCode :: TcRn Bool
- setInGeneratedCode :: TcRn a -> TcRn a
- wrapLocM :: (a -> TcM b) -> Located a -> TcM (Located b)
- wrapLocAM :: (a -> TcM b) -> LocatedAn an a -> TcM (Located b)
- wrapLocFstM :: (a -> TcM (b, c)) -> Located a -> TcM (Located b, c)
- wrapLocFstMA :: (a -> TcM (b, c)) -> GenLocated (SrcSpanAnn' ann) a -> TcM (GenLocated (SrcSpanAnn' ann) b, c)
- wrapLocSndM :: (a -> TcM (b, c)) -> Located a -> TcM (b, Located c)
- wrapLocSndMA :: (a -> TcM (b, c)) -> GenLocated (SrcSpanAnn' ann) a -> TcM (b, GenLocated (SrcSpanAnn' ann) c)
- wrapLocM_ :: (a -> TcM ()) -> Located a -> TcM ()
- wrapLocMA_ :: (a -> TcM ()) -> LocatedA a -> TcM ()
- wrapLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcRn (GenLocated (SrcSpanAnn' ann) b)
- getErrsVar :: TcRn (TcRef (Messages TcRnMessage))
- setErrsVar :: TcRef (Messages TcRnMessage) -> TcRn a -> TcRn a
- addErr :: TcRnMessage -> TcRn ()
- failWith :: TcRnMessage -> TcRn a
- failAt :: SrcSpan -> TcRnMessage -> TcRn a
- addErrAt :: SrcSpan -> TcRnMessage -> TcRn ()
- addErrs :: [(SrcSpan, TcRnMessage)] -> TcRn ()
- checkErr :: Bool -> TcRnMessage -> TcRn ()
- checkErrAt :: SrcSpan -> Bool -> TcRnMessage -> TcRn ()
- addMessages :: Messages TcRnMessage -> TcRn ()
- discardWarnings :: TcRn a -> TcRn a
- mkDetailedMessage :: ErrInfo -> TcRnMessage -> TcRnMessageDetailed
- tcCollectingUsage :: TcM a -> TcM (UsageEnv, a)
- tcScalingUsage :: Mult -> TcM a -> TcM a
- tcEmitBindingUsage :: UsageEnv -> TcM ()
- 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 TcRnMessage)
- 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 -> ZonkM (TidyEnv, SDoc)) -> TcM a -> TcM a
- addLandmarkErrCtxt :: SDoc -> TcM a -> TcM a
- addLandmarkErrCtxtM :: (TidyEnv -> ZonkM (TidyEnv, SDoc)) -> TcM a -> TcM a
- popErrCtxt :: TcM a -> TcM a
- getCtLocM :: CtOrigin -> Maybe TypeOrKind -> TcM CtLoc
- setCtLocM :: CtLoc -> TcM a -> TcM a
- mkCtLocEnv :: TcLclEnv -> CtLocEnv
- addErrTc :: TcRnMessage -> TcM ()
- addErrTcM :: (TidyEnv, TcRnMessage) -> TcM ()
- failWithTc :: TcRnMessage -> TcM a
- failWithTcM :: (TidyEnv, TcRnMessage) -> TcM a
- checkTc :: Bool -> TcRnMessage -> TcM ()
- checkTcM :: Bool -> (TidyEnv, TcRnMessage) -> TcM ()
- failIfTc :: Bool -> TcRnMessage -> TcM ()
- failIfTcM :: Bool -> (TidyEnv, TcRnMessage) -> TcM ()
- mkErrInfo :: TidyEnv -> [ErrCtxt] -> TcM SDoc
- addTcRnDiagnostic :: TcRnMessage -> TcM ()
- addDetailedDiagnostic :: (ErrInfo -> TcRnMessage) -> TcM ()
- mkTcRnMessage :: SrcSpan -> TcRnMessage -> TcRn (MsgEnvelope TcRnMessage)
- reportDiagnostic :: MsgEnvelope TcRnMessage -> TcRn ()
- reportDiagnostics :: [MsgEnvelope TcRnMessage] -> TcM ()
- warnIf :: Bool -> TcRnMessage -> TcRn ()
- diagnosticTc :: Bool -> TcRnMessage -> TcM ()
- diagnosticTcM :: Bool -> (TidyEnv, TcRnMessage) -> TcM ()
- addDiagnosticTc :: TcRnMessage -> TcM ()
- addDiagnosticTcM :: (TidyEnv, TcRnMessage) -> TcM ()
- addDiagnostic :: TcRnMessage -> TcRn ()
- addDiagnosticAt :: SrcSpan -> TcRnMessage -> TcRn ()
- 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 ()
- emitDelayedErrors :: Bag DelayedError -> TcM ()
- emitHole :: Hole -> TcM ()
- emitHoles :: Bag Hole -> TcM ()
- emitNotConcreteError :: NotConcreteError -> 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)
- 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 ()
- recordThNeededRuntimeDeps :: [Linkable] -> PkgsLoaded -> TcM ()
- keepAlive :: Name -> TcRn ()
- getStage :: TcM ThStage
- getStageAndBindLevel :: Name -> TcRn (Maybe (TopLevelFlag, ThLevel, ThStage))
- setStage :: ThStage -> TcM a -> TcRn a
- addModFinalizersWithLclEnv :: ThModFinalizers -> TcM ()
- recordUnsafeInfer :: Messages TcRnMessage -> 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
- initIfaceLoadModule :: HscEnv -> Module -> IfG a -> IO a
- getIfModule :: IfL Module
- failIfM :: SDoc -> IfL a
- forkM :: SDoc -> IfL a -> IfL a
- setImplicitEnvM :: TypeEnv -> IfL a -> IfL a
- withException :: MonadIO m => SDocContext -> m (MaybeErr SDoc a) -> m a
- withIfaceErr :: MonadIO m => SDocContext -> m (MaybeErr MissingInterfaceError a) -> m a
- getCCIndexM :: (gbl -> TcRef CostCentreState) -> FastString -> TcRnIf gbl lcl CostCentreIndex
- getCCIndexTcM :: FastString -> TcM CostCentreIndex
- liftZonkM :: ZonkM a -> TcM a
- module GHC.Tc.Types
- module GHC.Data.IOEnv
Initialisation
initTc :: HscEnv -> HscSource -> Bool -> Module -> RealSrcSpan -> TcM r -> IO (Messages TcRnMessage, Maybe r) Source #
Setup the initial typechecking environment
initTcWithGbl :: HscEnv -> TcGblEnv -> RealSrcSpan -> TcM r -> IO (Messages TcRnMessage, Maybe r) Source #
Run a TcM
action in the context of an existing GblEnv
.
initTcInteractive :: HscEnv -> TcM a -> IO (Messages TcRnMessage, Maybe a) Source #
Simple accessors
discardResult :: TcM a -> TcM () Source #
unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
getGhcMode :: TcRnIf gbl lcl GhcMode Source #
withoutDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
getEps :: TcRnIf gbl lcl ExternalPackageState 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.
getHpt :: TcRnIf gbl lcl HomePackageTable Source #
getEpsAndHug :: TcRnIf gbl lcl (ExternalPackageState, HomeUnitGraph) Source #
Arrow scopes
newArrowScope :: TcM a -> TcM a Source #
escapeArrowScope :: TcM a -> TcM a Source #
Unique supply
newUniqueSupply :: TcRnIf gbl lcl UniqSupply Source #
newSysLocalId :: FastString -> Mult -> TcType -> TcRnIf gbl lcl TcId Source #
newSysLocalIds :: FastString -> [Scaled TcType] -> TcRnIf gbl lcl [TcId] Source #
Accessing input/output
writeTcRef :: MonadIO m => TcRef a -> a -> m () Source #
Debugging
dumpOptTcRn :: DumpFlag -> String -> DumpFormat -> SDoc -> TcRn () Source #
Dump if the given DumpFlag
is set.
printForUserTcRn :: SDoc -> TcRn () Source #
Like logInfoTcRn, but for user consumption
Typechecker global environment
getGHCiMonad :: TcRn Name Source #
getRdrEnvs :: TcRn (GlobalRdrEnv, LocalRdrEnv) Source #
addDependentFiles :: [FilePath] -> TcRn () Source #
Error management
setSrcSpanA :: SrcSpanAnn' ann -> TcRn a -> TcRn a Source #
addLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcM b Source #
setInGeneratedCode :: TcRn a -> TcRn a Source #
Mark the inner computation as being done inside generated code.
See Note [Error contexts in generated code]
wrapLocFstMA :: (a -> TcM (b, c)) -> GenLocated (SrcSpanAnn' ann) a -> TcM (GenLocated (SrcSpanAnn' ann) b, c) Source #
wrapLocSndMA :: (a -> TcM (b, c)) -> GenLocated (SrcSpanAnn' ann) a -> TcM (b, GenLocated (SrcSpanAnn' ann) c) Source #
wrapLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcRn (GenLocated (SrcSpanAnn' ann) b) Source #
getErrsVar :: TcRn (TcRef (Messages TcRnMessage)) Source #
setErrsVar :: TcRef (Messages TcRnMessage) -> TcRn a -> TcRn a Source #
addErr :: TcRnMessage -> TcRn () Source #
failWith :: TcRnMessage -> TcRn a Source #
checkErrAt :: SrcSpan -> Bool -> TcRnMessage -> TcRn () Source #
addMessages :: Messages TcRnMessage -> 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
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 #
checkNoErrs :: TcM r -> TcM r Source #
whenNoErrs :: TcM () -> TcM () Source #
failIfErrsM :: TcRn () Source #
Context management for the type checker
getErrCtxt :: TcM [ErrCtxt] 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 -> ZonkM (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 -> ZonkM (TidyEnv, SDoc)) -> TcM a -> TcM a Source #
Variant of addLandmarkErrCtxt
that allows for monadic operations
and tidying.
popErrCtxt :: TcM a -> TcM a Source #
mkCtLocEnv :: TcLclEnv -> CtLocEnv Source #
Diagnostic message generation (type checker)
addErrTc :: TcRnMessage -> TcM () Source #
failWithTc :: TcRnMessage -> TcM a Source #
failWithTcM :: (TidyEnv, TcRnMessage) -> TcM a Source #
addTcRnDiagnostic :: TcRnMessage -> TcM () Source #
addDetailedDiagnostic :: (ErrInfo -> TcRnMessage) -> TcM () Source #
A variation of addDiagnostic
that takes a function to produce a TcRnDsMessage
given some additional context about the diagnostic.
mkTcRnMessage :: SrcSpan -> TcRnMessage -> TcRn (MsgEnvelope TcRnMessage) Source #
reportDiagnostic :: MsgEnvelope TcRnMessage -> TcRn () Source #
reportDiagnostics :: [MsgEnvelope TcRnMessage] -> TcM () Source #
diagnosticTc :: Bool -> TcRnMessage -> TcM () Source #
Display a warning if a condition is met.
diagnosticTcM :: Bool -> (TidyEnv, TcRnMessage) -> TcM () Source #
Display a diagnostic if a condition is met.
addDiagnosticTc :: TcRnMessage -> TcM () Source #
Display a diagnostic in the current context.
addDiagnosticTcM :: (TidyEnv, TcRnMessage) -> TcM () Source #
Display a diagnostic in a given context.
addDiagnostic :: TcRnMessage -> TcRn () Source #
Display a diagnostic for the current source location, taken from
the TcRn
monad.
addDiagnosticAt :: SrcSpan -> TcRnMessage -> TcRn () Source #
Display a diagnostic for a given source location.
Type constraints
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
addTcEvBind :: EvBindsVar -> EvBind -> TcM () Source #
getTcEvBindsMap :: EvBindsVar -> TcM EvBindMap Source #
setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcM () 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 #
emitDelayedErrors :: Bag DelayedError -> TcM () Source #
emitNotConcreteError :: NotConcreteError -> 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 #
getTcLevel :: TcM TcLevel Source #
traceTcConstraints :: String -> TcM () Source #
data IsExtraConstraint Source #
Instances
Outputable IsExtraConstraint Source # | |
Defined in GHC.Tc.Utils.Monad ppr :: IsExtraConstraint -> SDoc Source # |
emitAnonTypeHole :: IsExtraConstraint -> TcTyVar -> TcM () Source #
Template Haskell context
recordThUse :: TcM () Source #
recordThSpliceUse :: TcM () Source #
recordThNeededRuntimeDeps :: [Linkable] -> PkgsLoaded -> 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 :: Messages TcRnMessage -> 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
setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a Source #
Stuff for interface decls
mkIfLclEnv :: Module -> SDoc -> IsBootInterface -> IfLclEnv Source #
initIfaceTcRn :: IfG a -> TcRn 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 #
initIfaceLoad
can be used when there's no chance that the action will
call typecheckIface
when inside a module loop and hence tcIfaceGlobal
.
initIfaceLoadModule :: HscEnv -> Module -> IfG a -> IO a Source #
This is used when we are doing to call typecheckModule
on an ModIface
,
if it's part of a loop with some other modules then we need to use their
IORef TypeEnv vars when typechecking but crucially not our own.
getIfModule :: IfL Module Source #
forkM :: SDoc -> IfL a -> IfL a Source #
Run thing_inside in an interleaved thread. It shares everything with the parent thread, so this is DANGEROUS.
It throws an error if the computation fails
It's used for lazily type-checking interface signatures, which is pretty benign.
See Note [Masking exceptions in forkM]
withException :: MonadIO m => SDocContext -> m (MaybeErr SDoc a) -> m a Source #
A convenient wrapper for taking a MaybeErr SDoc a
and throwing
an exception if it is an error.
withIfaceErr :: MonadIO m => SDocContext -> m (MaybeErr MissingInterfaceError a) -> m a Source #
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
.
Zonking
Types etc.
module GHC.Tc.Types
module GHC.Data.IOEnv
Orphan instances
MonadUnique (IOEnv (Env gbl lcl)) Source # | |
getUniqueSupplyM :: IOEnv (Env gbl lcl) UniqSupply Source # |