TcRnMonad

ghc-7.6.3: The GHC API

Safe Haskell | None

TcRnMonad

Synopsis

- initTc :: HscEnv -> HscSource -> Bool -> Module -> TcM r -> IO (Messages, Maybe r)
- initTcPrintErrors :: HscEnv -> Module -> TcM r -> IO (Messages, Maybe r)
- initTcForLookup :: HscEnv -> TcM a -> IO a
- initTcRnIf :: Char -> HscEnv -> gbl -> lcl -> TcRnIf gbl lcl a -> IO a
- discardResult :: TcM a -> TcM ()
- getTopEnv :: TcRnIf gbl lcl HscEnv
- 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 :: ExtensionFlag -> TcRnIf gbl lcl Bool
- doptM :: DynFlag -> TcRnIf gbl lcl Bool
- woptM :: WarningFlag -> TcRnIf gbl lcl Bool
- setXOptM :: ExtensionFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetDOptM :: DynFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- ifDOptM :: DynFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- ifWOptM :: WarningFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- ifXOptM :: ExtensionFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- getGhcMode :: TcRnIf gbl lcl GhcMode
- 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)
- newMetaUnique :: TcM Unique
- newUnique :: TcRnIf gbl lcl Unique
- newUniqueSupply :: TcRnIf gbl lcl UniqSupply
- newLocalName :: Name -> TcRnIf gbl lcl Name
- newSysLocalIds :: FastString -> [TcType] -> TcRnIf gbl lcl [TcId]
- newName :: OccName -> TcM Name
- 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 ()
- traceTcN :: Int -> String -> SDoc -> TcRn ()
- traceRn :: SDoc -> TcRn ()
- traceSplice :: SDoc -> TcRn ()
- traceIf :: SDoc -> TcRnIf m n ()
- traceHiDiffs :: SDoc -> TcRnIf m n ()
- traceOptIf :: DynFlag -> SDoc -> TcRnIf m n ()
- traceOptTcRn :: DynFlag -> SDoc -> TcRn ()
- dumpTcRn :: SDoc -> TcRn ()
- debugDumpTcRn :: SDoc -> TcRn ()
- dumpOptTcRn :: DynFlag -> SDoc -> TcRn ()
- getModule :: TcRn Module
- setModule :: Module -> TcRn a -> TcRn a
- getIsGHCi :: TcRn Bool
- getGHCiMonad :: TcRn Name
- getInteractivePrintName :: TcRn Name
- tcIsHsBoot :: TcRn Bool
- 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
- 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)
- getErrsVar :: TcRn (TcRef Messages)
- setErrsVar :: TcRef Messages -> TcRn a -> TcRn a
- addErr :: MsgDoc -> TcRn ()
- failWith :: MsgDoc -> TcRn a
- addErrAt :: SrcSpan -> MsgDoc -> TcRn ()
- addErrs :: [(SrcSpan, MsgDoc)] -> TcRn ()
- checkErr :: Bool -> MsgDoc -> TcRn ()
- warnIf :: Bool -> MsgDoc -> TcRn ()
- addMessages :: Messages -> TcRn ()
- discardWarnings :: TcRn a -> TcRn a
- mkLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ErrMsg
- addLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()
- reportErrors :: [ErrMsg] -> TcM ()
- reportError :: ErrMsg -> TcRn ()
- reportWarning :: ErrMsg -> TcRn ()
- dumpDerivingInfo :: SDoc -> TcM ()
- try_m :: TcRn r -> TcRn (Either IOEnvFailure r)
- recoverM :: TcRn r -> TcRn r -> TcRn r
- mapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b]
- tryTc :: TcRn a -> TcRn (Messages, Maybe a)
- tryTcErrs :: TcRn a -> TcRn (Messages, Maybe a)
- tryTcLIE :: TcM a -> TcM (Messages, Maybe a)
- tryTcLIE_ :: TcM r -> TcM r -> TcM r
- checkNoErrs :: TcM r -> TcM r
- ifErrsM :: TcRn r -> TcRn r -> TcRn r
- failIfErrsM :: TcRn ()
- getErrCtxt :: TcM [ErrCtxt]
- setErrCtxt :: [ErrCtxt] -> TcM a -> TcM a
- addErrCtxt :: MsgDoc -> TcM a -> TcM a
- addErrCtxtM :: (TidyEnv -> TcM (TidyEnv, MsgDoc)) -> TcM a -> TcM a
- addLandmarkErrCtxt :: MsgDoc -> TcM a -> TcM a
- updCtxt :: ([ErrCtxt] -> [ErrCtxt]) -> TcM a -> TcM a
- popErrCtxt :: TcM a -> TcM a
- getCtLoc :: orig -> TcM (CtLoc orig)
- setCtLoc :: CtLoc orig -> TcM a -> TcM a
- addErrTc :: MsgDoc -> TcM ()
- addErrsTc :: [MsgDoc] -> TcM ()
- addErrTcM :: (TidyEnv, MsgDoc) -> TcM ()
- mkErrTcM :: (TidyEnv, MsgDoc) -> TcM ErrMsg
- failWithTc :: MsgDoc -> TcM a
- failWithTcM :: (TidyEnv, MsgDoc) -> TcM a
- checkTc :: Bool -> MsgDoc -> TcM ()
- warnTc :: Bool -> MsgDoc -> TcM ()
- addWarnTc :: MsgDoc -> TcM ()
- addWarnTcM :: (TidyEnv, MsgDoc) -> TcM ()
- addWarn :: MsgDoc -> TcRn ()
- addWarnAt :: SrcSpan -> MsgDoc -> TcRn ()
- add_warn :: MsgDoc -> MsgDoc -> TcRn ()
- add_warn_at :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()
- tcInitTidyEnv :: TcM TidyEnv
- add_err_tcm :: TidyEnv -> MsgDoc -> SrcSpan -> [ErrCtxt] -> TcM ()
- mkErrInfo :: TidyEnv -> [ErrCtxt] -> TcM SDoc
- mAX_CONTEXTS :: Int
- debugTc :: TcM () -> TcM ()
- newTcEvBinds :: TcM EvBindsVar
- addTcEvBind :: EvBindsVar -> EvVar -> EvTerm -> TcM ()
- getTcEvBinds :: EvBindsVar -> TcM (Bag EvBind)
- chooseUniqueOccTc :: (OccSet -> OccName) -> TcM OccName
- getConstraintVar :: TcM (TcRef WantedConstraints)
- setConstraintVar :: TcRef WantedConstraints -> TcM a -> TcM a
- emitConstraints :: WantedConstraints -> TcM ()
- emitFlat :: Ct -> TcM ()
- emitFlats :: Cts -> TcM ()
- emitImplication :: Implication -> TcM ()
- emitImplications :: Bag Implication -> TcM ()
- captureConstraints :: TcM a -> TcM (a, WantedConstraints)
- captureUntouchables :: TcM a -> TcM (a, Untouchables)
- isUntouchable :: TcTyVar -> TcM Bool
- getLclTypeEnv :: TcM TcTypeEnv
- setLclTypeEnv :: TcLclEnv -> TcM a -> TcM a
- traceTcConstraints :: String -> TcM ()
- recordThUse :: TcM ()
- recordThSpliceUse :: TcM ()
- keepAliveTc :: Id -> TcM ()
- keepAliveSetTc :: NameSet -> TcM ()
- getStage :: TcM ThStage
- setStage :: ThStage -> TcM a -> TcM a
- recordUnsafeInfer :: TcM ()
- finalSafeMode :: DynFlags -> TcGblEnv -> IO SafeHaskellMode
- getLocalRdrEnv :: RnM LocalRdrEnv
- setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a
- mkIfLclEnv :: Module -> SDoc -> IfLclEnv
- initIfaceTcRn :: IfG a -> TcRn a
- initIfaceExtCore :: IfL a -> TcRn a
- initIfaceCheck :: HscEnv -> IfG a -> IO a
- initIfaceTc :: ModIface -> (TcRef TypeEnv -> IfL a) -> TcRnIf gbl lcl a
- initIfaceLcl :: Module -> SDoc -> IfL a -> IfM lcl a
- getIfModule :: IfL Module
- failIfM :: MsgDoc -> IfL a
- forkM_maybe :: SDoc -> IfL a -> IfL (Maybe a)
- forkM :: SDoc -> IfL a -> IfL a
- module TcRnTypes
- module IOEnv

# Documentation

initTc :: HscEnv -> HscSource -> Bool -> Module -> TcM r -> IO (Messages, Maybe r)

Setup the initial typechecking environment

initTcPrintErrors :: HscEnv -> Module -> TcM r -> IO (Messages, Maybe r)

initTcForLookup :: HscEnv -> TcM a -> IO a

initTcRnIf :: Char -> HscEnv -> gbl -> lcl -> TcRnIf gbl lcl a -> IO a

discardResult :: TcM a -> TcM ()

getTopEnv :: TcRnIf gbl lcl HscEnv

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 :: ExtensionFlag -> TcRnIf gbl lcl Bool

doptM :: DynFlag -> TcRnIf gbl lcl Bool

woptM :: WarningFlag -> TcRnIf gbl lcl Bool

setXOptM :: ExtensionFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a

unsetDOptM :: DynFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a

unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a

ifDOptM :: DynFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()

Do it flag is true

ifWOptM :: WarningFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()

ifXOptM :: ExtensionFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()

getGhcMode :: TcRnIf gbl lcl GhcMode

getEpsVar :: TcRnIf gbl lcl (TcRef ExternalPackageState)

getEps :: TcRnIf gbl lcl ExternalPackageState

updateEps :: (ExternalPackageState -> (ExternalPackageState, a)) -> TcRnIf gbl lcl a

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 ()

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

getEpsAndHpt :: TcRnIf gbl lcl (ExternalPackageState, HomePackageTable)

newMetaUnique :: TcM Unique

newUnique :: TcRnIf gbl lcl Unique

newUniqueSupply :: TcRnIf gbl lcl UniqSupply

newLocalName :: Name -> TcRnIf gbl lcl Name

newSysLocalIds :: FastString -> [TcType] -> TcRnIf gbl lcl [TcId]

newName :: OccName -> TcM Name

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 ()

traceTcN :: Int -> String -> SDoc -> TcRn ()

traceRn :: SDoc -> TcRn ()

traceSplice :: SDoc -> TcRn ()

traceIf :: SDoc -> TcRnIf m n ()

traceHiDiffs :: SDoc -> TcRnIf m n ()

traceOptIf :: DynFlag -> SDoc -> TcRnIf m n ()

traceOptTcRn :: DynFlag -> SDoc -> TcRn ()

dumpTcRn :: SDoc -> TcRn ()

debugDumpTcRn :: SDoc -> TcRn ()

dumpOptTcRn :: DynFlag -> SDoc -> TcRn ()

getModule :: TcRn Module

setModule :: Module -> TcRn a -> TcRn a

getIsGHCi :: TcRn Bool

getGHCiMonad :: TcRn Name

getInteractivePrintName :: TcRn Name

tcIsHsBoot :: TcRn Bool

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

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)

getErrsVar :: TcRn (TcRef Messages)

setErrsVar :: TcRef Messages -> TcRn a -> TcRn a

addErr :: MsgDoc -> TcRn ()

failWith :: MsgDoc -> TcRn a

addErrAt :: SrcSpan -> MsgDoc -> TcRn ()

addErrs :: [(SrcSpan, MsgDoc)] -> TcRn ()

checkErr :: Bool -> MsgDoc -> TcRn ()

warnIf :: Bool -> MsgDoc -> TcRn ()

addMessages :: Messages -> TcRn ()

discardWarnings :: TcRn a -> TcRn a

mkLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ErrMsg

addLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()

reportErrors :: [ErrMsg] -> TcM ()

reportError :: ErrMsg -> TcRn ()

reportWarning :: ErrMsg -> TcRn ()

dumpDerivingInfo :: SDoc -> TcM ()

try_m :: TcRn r -> TcRn (Either IOEnvFailure r)

recoverM :: TcRn r -> TcRn r -> TcRn r

mapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b]

tryTc :: TcRn a -> TcRn (Messages, Maybe a)

tryTcErrs :: TcRn a -> TcRn (Messages, Maybe a)

tryTcLIE :: TcM a -> TcM (Messages, Maybe a)

tryTcLIE_ :: TcM r -> TcM r -> TcM r

checkNoErrs :: TcM r -> TcM r

ifErrsM :: TcRn r -> TcRn r -> TcRn r

failIfErrsM :: TcRn ()

getErrCtxt :: TcM [ErrCtxt]

setErrCtxt :: [ErrCtxt] -> TcM a -> TcM a

addErrCtxt :: MsgDoc -> TcM a -> TcM a

addErrCtxtM :: (TidyEnv -> TcM (TidyEnv, MsgDoc)) -> TcM a -> TcM a

addLandmarkErrCtxt :: MsgDoc -> TcM a -> TcM a

updCtxt :: ([ErrCtxt] -> [ErrCtxt]) -> TcM a -> TcM a

popErrCtxt :: TcM a -> TcM a

getCtLoc :: orig -> TcM (CtLoc orig)

setCtLoc :: CtLoc orig -> TcM a -> TcM a

addErrTc :: MsgDoc -> TcM ()

addErrsTc :: [MsgDoc] -> TcM ()

addErrTcM :: (TidyEnv, MsgDoc) -> TcM ()

mkErrTcM :: (TidyEnv, MsgDoc) -> TcM ErrMsg

failWithTc :: MsgDoc -> TcM a

failWithTcM :: (TidyEnv, MsgDoc) -> TcM a

checkTc :: Bool -> MsgDoc -> TcM ()

warnTc :: Bool -> MsgDoc -> TcM ()

addWarnTc :: MsgDoc -> TcM ()

addWarnTcM :: (TidyEnv, MsgDoc) -> TcM ()

addWarn :: MsgDoc -> TcRn ()

addWarnAt :: SrcSpan -> MsgDoc -> TcRn ()

add_warn :: MsgDoc -> MsgDoc -> TcRn ()

add_warn_at :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()

tcInitTidyEnv :: TcM TidyEnv

add_err_tcm :: TidyEnv -> MsgDoc -> SrcSpan -> [ErrCtxt] -> TcM ()

mkErrInfo :: TidyEnv -> [ErrCtxt] -> TcM SDoc

mAX_CONTEXTS :: Int

debugTc :: TcM () -> TcM ()

newTcEvBinds :: TcM EvBindsVar

addTcEvBind :: EvBindsVar -> EvVar -> EvTerm -> TcM ()

getTcEvBinds :: EvBindsVar -> TcM (Bag EvBind)

chooseUniqueOccTc :: (OccSet -> OccName) -> TcM OccName

getConstraintVar :: TcM (TcRef WantedConstraints)

setConstraintVar :: TcRef WantedConstraints -> TcM a -> TcM a

emitConstraints :: WantedConstraints -> TcM ()

emitFlat :: Ct -> TcM ()

emitFlats :: Cts -> TcM ()

emitImplication :: Implication -> TcM ()

emitImplications :: Bag Implication -> TcM ()

captureConstraints :: TcM a -> TcM (a, WantedConstraints)

captureUntouchables :: TcM a -> TcM (a, Untouchables)

isUntouchable :: TcTyVar -> TcM Bool

getLclTypeEnv :: TcM TcTypeEnv

setLclTypeEnv :: TcLclEnv -> TcM a -> TcM a

traceTcConstraints :: String -> TcM ()

recordThUse :: TcM ()

recordThSpliceUse :: TcM ()

keepAliveTc :: Id -> TcM ()

keepAliveSetTc :: NameSet -> TcM ()

getStage :: TcM ThStage

setStage :: ThStage -> TcM a -> TcM a

recordUnsafeInfer :: TcM ()

Mark that safe inference has failed

finalSafeMode :: DynFlags -> TcGblEnv -> IO SafeHaskellMode

Figure out the final correct safe haskell mode

getLocalRdrEnv :: RnM LocalRdrEnv

setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a

mkIfLclEnv :: Module -> SDoc -> IfLclEnv

initIfaceTcRn :: IfG a -> TcRn a

initIfaceExtCore :: IfL a -> TcRn a

initIfaceCheck :: HscEnv -> IfG a -> IO a

initIfaceTc :: ModIface -> (TcRef TypeEnv -> IfL a) -> TcRnIf gbl lcl a

initIfaceLcl :: Module -> SDoc -> IfL a -> IfM lcl a

getIfModule :: IfL Module

failIfM :: MsgDoc -> IfL a

forkM_maybe :: SDoc -> IfL a -> IfL (Maybe a)

forkM :: SDoc -> IfL a -> IfL a

module TcRnTypes

module IOEnv