ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

TcRnDriver

Synopsis

- tcRnStmt :: HscEnv -> GhciLStmt RdrName -> IO (Messages, Maybe ([Id], LHsExpr Id, FixityEnv))
- tcRnExpr :: HscEnv -> TcRnExprMode -> LHsExpr RdrName -> IO (Messages, Maybe Type)
- data TcRnExprMode
  - = TM_Inst
  - | TM_NoInst
  - | TM_Default
- tcRnType :: HscEnv -> Bool -> LHsType RdrName -> IO (Messages, Maybe (Type, Kind))
- tcRnImportDecls :: HscEnv -> [LImportDecl RdrName] -> IO (Messages, Maybe GlobalRdrEnv)
- tcRnLookupRdrName :: HscEnv -> Located RdrName -> IO (Messages, Maybe [Name])
- getModuleInterface :: HscEnv -> Module -> IO (Messages, Maybe ModIface)
- tcRnDeclsi :: HscEnv -> [LHsDecl RdrName] -> IO (Messages, Maybe TcGblEnv)
- isGHCiMonad :: HscEnv -> String -> IO (Messages, Maybe Name)
- runTcInteractive :: HscEnv -> TcRn a -> IO (Messages, Maybe a)
- tcRnLookupName :: HscEnv -> Name -> IO (Messages, Maybe TyThing)
- tcRnGetInfo :: HscEnv -> Name -> IO (Messages, Maybe (TyThing, Fixity, [ClsInst], [FamInst]))
- tcRnModule :: HscEnv -> HscSource -> Bool -> HsParsedModule -> IO (Messages, Maybe TcGblEnv)
- tcRnModuleTcRnM :: HscEnv -> HscSource -> HsParsedModule -> (Module, SrcSpan) -> TcRn TcGblEnv
- tcTopSrcDecls :: HsGroup Name -> TcM (TcGblEnv, TcLclEnv)
- rnTopSrcDecls :: HsGroup RdrName -> TcM (TcGblEnv, HsGroup Name)
- checkBootDecl :: Bool -> TyThing -> TyThing -> Maybe SDoc
- checkHiBootIface' :: [ClsInst] -> TypeEnv -> [AvailInfo] -> ModDetails -> TcM [(Id, Id)]
- findExtraSigImports :: HscEnv -> HscSource -> ModuleName -> IO [(Maybe FastString, Located ModuleName)]
- implicitRequirements :: HscEnv -> [(Maybe FastString, Located ModuleName)] -> IO [(Maybe FastString, Located ModuleName)]
- checkUnitId :: UnitId -> TcM ()
- mergeSignatures :: HsParsedModule -> TcGblEnv -> ModIface -> TcRn TcGblEnv
- tcRnMergeSignatures :: HscEnv -> HsParsedModule -> TcGblEnv -> ModIface -> IO (Messages, Maybe TcGblEnv)
- instantiateSignature :: TcRn TcGblEnv
- tcRnInstantiateSignature :: HscEnv -> Module -> RealSrcSpan -> IO (Messages, Maybe TcGblEnv)
- loadUnqualIfaces :: HscEnv -> InteractiveContext -> TcM ()
- badReexportedBootThing :: DynFlags -> Bool -> Name -> Name -> SDoc
- checkBootDeclM :: Bool -> TyThing -> TyThing -> TcM ()
- missingBootThing :: Bool -> Name -> String -> SDoc

# Documentation

tcRnStmt :: HscEnv -> GhciLStmt RdrName -> IO (Messages, Maybe ([Id], LHsExpr Id, FixityEnv)) #

The returned [Id] is the list of new Ids bound by this statement. It can be used to extend the InteractiveContext via extendInteractiveContext.

The returned TypecheckedHsExpr is of type IO [ () ], a list of the bound values, coerced to ().

tcRnExpr :: HscEnv -> TcRnExprMode -> LHsExpr RdrName -> IO (Messages, Maybe Type) #

tcRnExpr just finds the type of an expression

data TcRnExprMode #

How should we infer a type? See Note [TcRnExprMode]

Constructors

TM_Inst | Instantiate the type fully (:type)
TM_NoInst | Do not instantiate the type (:type +v)
TM_Default | Default the type eagerly (:type +d)

tcRnType :: HscEnv -> Bool -> LHsType RdrName -> IO (Messages, Maybe (Type, Kind)) #

tcRnImportDecls :: HscEnv -> [LImportDecl RdrName] -> IO (Messages, Maybe GlobalRdrEnv) #

tcRnLookupRdrName :: HscEnv -> Located RdrName -> IO (Messages, Maybe [Name]) #

Find all the Names that this RdrName could mean, in GHCi

getModuleInterface :: HscEnv -> Module -> IO (Messages, Maybe ModIface) #

ASSUMES that the module is either in the `HomePackageTable` or is a package module with an interface on disk. If neither of these is true, then the result will be an error indicating the interface could not be found.

tcRnDeclsi :: HscEnv -> [LHsDecl RdrName] -> IO (Messages, Maybe TcGblEnv) #

isGHCiMonad :: HscEnv -> String -> IO (Messages, Maybe Name) #

runTcInteractive :: HscEnv -> TcRn a -> IO (Messages, Maybe a) #

tcRnLookupName :: HscEnv -> Name -> IO (Messages, Maybe TyThing) #

tcRnGetInfo :: HscEnv -> Name -> IO (Messages, Maybe (TyThing, Fixity, [ClsInst], [FamInst])) #

tcRnModule :: HscEnv -> HscSource -> Bool -> HsParsedModule -> IO (Messages, Maybe TcGblEnv) #

Top level entry point for typechecker and renamer

tcRnModuleTcRnM :: HscEnv -> HscSource -> HsParsedModule -> (Module, SrcSpan) -> TcRn TcGblEnv #

tcTopSrcDecls :: HsGroup Name -> TcM (TcGblEnv, TcLclEnv) #

rnTopSrcDecls :: HsGroup RdrName -> TcM (TcGblEnv, HsGroup Name) #

checkBootDecl :: Bool -> TyThing -> TyThing -> Maybe SDoc #

Compares the two things for equivalence between boot-file and normal code. Returns `Nothing` on success or `Just "some helpful info for user"` failure. If the difference will be apparent to the user, `Just empty` is perfectly suitable.

checkHiBootIface' :: [ClsInst] -> TypeEnv -> [AvailInfo] -> ModDetails -> TcM [(Id, Id)] #

findExtraSigImports :: HscEnv -> HscSource -> ModuleName -> IO [(Maybe FastString, Located ModuleName)] #

`findExtraSigImports`, but in a convenient form for GhcMake and TcRnDriver.

implicitRequirements :: HscEnv -> [(Maybe FastString, Located ModuleName)] -> IO [(Maybe FastString, Located ModuleName)] #

checkUnitId :: UnitId -> TcM () #

Given a `UnitId`, make sure it is well typed. This is because unit IDs come from Cabal, which does not know if things are well-typed or not; a component may have been filled with implementations for the holes that don't actually fulfill the requirements.

INVARIANT: the UnitId is NOT a InstalledUnitId

mergeSignatures :: HsParsedModule -> TcGblEnv -> ModIface -> TcRn TcGblEnv #

Given a local `ModIface`, merge all inherited requirements from `requirementMerges` into this signature, producing a final `TcGblEnv` that matches the local signature and all required signatures.

tcRnMergeSignatures :: HscEnv -> HsParsedModule -> TcGblEnv -> ModIface -> IO (Messages, Maybe TcGblEnv) #

Top-level driver for signature merging (run after typechecking an `hsig` file).

instantiateSignature :: TcRn TcGblEnv #

Given `tcg_mod`, instantiate a `ModIface` from the indefinite library to use the actual implementations of the relevant entities, checking that the implementation matches the signature.

tcRnInstantiateSignature :: HscEnv -> Module -> RealSrcSpan -> IO (Messages, Maybe TcGblEnv) #

Top-level driver for signature instantiation (run when compiling an `hsig` file.)

loadUnqualIfaces :: HscEnv -> InteractiveContext -> TcM () #

badReexportedBootThing :: DynFlags -> Bool -> Name -> Name -> SDoc #

checkBootDeclM #

Arguments

:: Bool | True = an hs-boot file (could also be a sig)
-> TyThing |
-> TyThing |
-> TcM () |

Compares two things for equivalence between boot-file and normal code, reporting an error if they don't match up.

missingBootThing :: Bool -> Name -> String -> SDoc #