TcEnv

ghc-8.10.5: The GHC API

Safe Haskell | None
Language | Haskell2010

TcEnv

Contents

- Orphan instances

Synopsis

- data TyThing
  - = AnId Id
  - | AConLike ConLike
  - | ATyCon TyCon
  - | ACoAxiom (CoAxiom Branched)
- data TcTyThing
  - = AGlobal TyThing
  - | ATcId {
    - tct_id :: TcId
    - tct_info :: IdBindingInfo
    }
  - | ATyVar Name TcTyVar
  - | ATcTyCon TyCon
  - | APromotionErr PromotionErr
- type TcId = Id
- data InstInfo a = InstInfo {
  - iSpec :: ClsInst
  - iBinds :: InstBindings a
  }
- iDFunId :: InstInfo a -> DFunId
- pprInstInfoDetails :: OutputableBndrId a => InstInfo (GhcPass a) -> SDoc
- simpleInstInfoClsTy :: InstInfo a -> (Class, Type)
- simpleInstInfoTy :: InstInfo a -> Type
- simpleInstInfoTyCon :: InstInfo a -> TyCon
- data InstBindings a = InstBindings {
  - ib_tyvars :: [Name]
  - ib_binds :: LHsBinds a
  - ib_pragmas :: [LSig a]
  - ib_extensions :: [Extension]
  - ib_derived :: Bool
  }
- tcExtendGlobalEnv :: [TyThing] -> TcM r -> TcM r
- tcExtendTyConEnv :: [TyCon] -> TcM r -> TcM r
- tcExtendGlobalEnvImplicit :: [TyThing] -> TcM r -> TcM r
- setGlobalTypeEnv :: TcGblEnv -> TypeEnv -> TcM TcGblEnv
- tcExtendGlobalValEnv :: [Id] -> TcM a -> TcM a
- tcLookupLocatedGlobal :: Located Name -> TcM TyThing
- tcLookupGlobal :: Name -> TcM TyThing
- tcLookupGlobalOnly :: Name -> TcM TyThing
- tcLookupTyCon :: Name -> TcM TyCon
- tcLookupClass :: Name -> TcM Class
- tcLookupDataCon :: Name -> TcM DataCon
- tcLookupPatSyn :: Name -> TcM PatSyn
- tcLookupConLike :: Name -> TcM ConLike
- tcLookupLocatedGlobalId :: Located Name -> TcM Id
- tcLookupLocatedTyCon :: Located Name -> TcM TyCon
- tcLookupLocatedClass :: Located Name -> TcM Class
- tcLookupAxiom :: Name -> TcM (CoAxiom Branched)
- lookupGlobal :: HscEnv -> Name -> IO TyThing
- ioLookupDataCon :: HscEnv -> Name -> IO DataCon
- addTypecheckedBinds :: TcGblEnv -> [LHsBinds GhcTc] -> TcGblEnv
- tcExtendKindEnv :: NameEnv TcTyThing -> TcM r -> TcM r
- tcExtendKindEnvList :: [(Name, TcTyThing)] -> TcM r -> TcM r
- tcExtendTyVarEnv :: [TyVar] -> TcM r -> TcM r
- tcExtendNameTyVarEnv :: [(Name, TcTyVar)] -> TcM r -> TcM r
- tcExtendLetEnv :: TopLevelFlag -> TcSigFun -> IsGroupClosed -> [TcId] -> TcM a -> TcM a
- tcExtendSigIds :: TopLevelFlag -> [TcId] -> TcM a -> TcM a
- tcExtendRecIds :: [(Name, TcId)] -> TcM a -> TcM a
- tcExtendIdEnv :: [TcId] -> TcM a -> TcM a
- tcExtendIdEnv1 :: Name -> TcId -> TcM a -> TcM a
- tcExtendIdEnv2 :: [(Name, TcId)] -> TcM a -> TcM a
- tcExtendBinderStack :: [TcBinder] -> TcM a -> TcM a
- tcExtendLocalTypeEnv :: TcLclEnv -> [(Name, TcTyThing)] -> TcLclEnv
- isTypeClosedLetBndr :: Id -> Bool
- tcLookup :: Name -> TcM TcTyThing
- tcLookupLocated :: Located Name -> TcM TcTyThing
- tcLookupLocalIds :: [Name] -> TcM [TcId]
- tcLookupId :: Name -> TcM Id
- tcLookupIdMaybe :: Name -> TcM (Maybe Id)
- tcLookupTyVar :: Name -> TcM TcTyVar
- tcLookupTcTyCon :: HasDebugCallStack => Name -> TcM TcTyCon
- tcLookupLcl_maybe :: Name -> TcM (Maybe TcTyThing)
- getInLocalScope :: TcM (Name -> Bool)
- wrongThingErr :: String -> TcTyThing -> Name -> TcM a
- pprBinders :: [Name] -> SDoc
- tcAddDataFamConPlaceholders :: [LInstDecl GhcRn] -> TcM a -> TcM a
- tcAddPatSynPlaceholders :: [PatSynBind GhcRn GhcRn] -> TcM a -> TcM a
- getTypeSigNames :: [LSig GhcRn] -> NameSet
- tcExtendRecEnv :: [(Name, TyThing)] -> TcM r -> TcM r
- tcInitTidyEnv :: TcM TidyEnv
- tcInitOpenTidyEnv :: [TyCoVar] -> TcM TidyEnv
- tcLookupInstance :: Class -> [Type] -> TcM ClsInst
- tcGetInstEnvs :: TcM InstEnvs
- tcExtendRules :: [LRuleDecl GhcTc] -> TcM a -> TcM a
- tcGetDefaultTys :: TcM ([Type], (Bool, Bool))
- checkWellStaged :: SDoc -> ThLevel -> ThLevel -> TcM ()
- tcMetaTy :: Name -> TcM Type
- thLevel :: ThStage -> ThLevel
- topIdLvl :: Id -> ThLevel
- isBrackStage :: ThStage -> Bool
- newDFunName :: Class -> [Type] -> SrcSpan -> TcM Name
- newFamInstTyConName :: Located Name -> [Type] -> TcM Name
- newFamInstAxiomName :: Located Name -> [[Type]] -> TcM Name
- mkStableIdFromString :: String -> Type -> SrcSpan -> (OccName -> OccName) -> TcM TcId
- mkStableIdFromName :: Name -> Type -> SrcSpan -> (OccName -> OccName) -> TcM TcId
- mkWrapperName :: (MonadIO m, HasDynFlags m, HasModule m) => String -> String -> m FastString

# Documentation

data TyThing #

A global typecheckable-thing, essentially anything that has a name. Not to be confused with a `TcTyThing`, which is also a typecheckable thing but in the *local* context. See `TcEnv` for how to retrieve a `TyThing` given a `Name`.

Constructors

AnId Id |
AConLike ConLike |
ATyCon TyCon |
ACoAxiom (CoAxiom Branched) |

#### Instances

Instances details

Outputable TyThing # |
Instance details Defined in TyCoRep Methods ppr :: TyThing -> SDoc # pprPrec :: Rational -> TyThing -> SDoc #
NamedThing TyThing # |
Instance details Defined in TyCoRep Methods getOccName :: TyThing -> OccName # getName :: TyThing -> Name #

data TcTyThing #

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`.

Constructors

AGlobal TyThing |
ATcId |
Fields tct_id :: TcId tct_info :: IdBindingInfo
ATyVar Name TcTyVar |
ATcTyCon TyCon |
APromotionErr PromotionErr |

#### Instances

Instances details

Outputable TcTyThing # |
Instance details Defined in TcRnTypes Methods ppr :: TcTyThing -> SDoc # pprPrec :: Rational -> TcTyThing -> SDoc #

type TcId = Id #

data InstInfo a #

Constructors

InstInfo |
Fields iSpec :: ClsInst iBinds :: InstBindings a

#### Instances

Instances details

OutputableBndrId a => Outputable (InstInfo (GhcPass a)) # |
Instance details Defined in TcEnv Methods ppr :: InstInfo (GhcPass a) -> SDoc # pprPrec :: Rational -> InstInfo (GhcPass a) -> SDoc #

iDFunId :: InstInfo a -> DFunId #

pprInstInfoDetails :: OutputableBndrId a => InstInfo (GhcPass a) -> SDoc #

simpleInstInfoClsTy :: InstInfo a -> (Class, Type) #

simpleInstInfoTy :: InstInfo a -> Type #

simpleInstInfoTyCon :: InstInfo a -> TyCon #

data InstBindings a #

Constructors

InstBindings |
Fields ib_tyvars :: [Name] ib_binds :: LHsBinds a ib_pragmas :: [LSig a] ib_extensions :: [Extension] ib_derived :: Bool

tcExtendGlobalEnv :: [TyThing] -> TcM r -> TcM r #

tcExtendTyConEnv :: [TyCon] -> TcM r -> TcM r #

tcExtendGlobalEnvImplicit :: [TyThing] -> TcM r -> TcM r #

setGlobalTypeEnv :: TcGblEnv -> TypeEnv -> TcM TcGblEnv #

tcExtendGlobalValEnv :: [Id] -> TcM a -> TcM a #

tcLookupLocatedGlobal :: Located Name -> TcM TyThing #

tcLookupGlobal :: Name -> TcM TyThing #

tcLookupGlobalOnly :: Name -> TcM TyThing #

tcLookupTyCon :: Name -> TcM TyCon #

tcLookupClass :: Name -> TcM Class #

tcLookupDataCon :: Name -> TcM DataCon #

tcLookupPatSyn :: Name -> TcM PatSyn #

tcLookupConLike :: Name -> TcM ConLike #

tcLookupLocatedGlobalId :: Located Name -> TcM Id #

tcLookupLocatedTyCon :: Located Name -> TcM TyCon #

tcLookupLocatedClass :: Located Name -> TcM Class #

tcLookupAxiom :: Name -> TcM (CoAxiom Branched) #

lookupGlobal :: HscEnv -> Name -> IO TyThing #

ioLookupDataCon :: HscEnv -> Name -> IO DataCon #

addTypecheckedBinds :: TcGblEnv -> [LHsBinds GhcTc] -> TcGblEnv #

tcExtendKindEnv :: NameEnv TcTyThing -> TcM r -> TcM r #

tcExtendKindEnvList :: [(Name, TcTyThing)] -> TcM r -> TcM r #

tcExtendTyVarEnv :: [TyVar] -> TcM r -> TcM r #

tcExtendNameTyVarEnv :: [(Name, TcTyVar)] -> TcM r -> TcM r #

tcExtendLetEnv :: TopLevelFlag -> TcSigFun -> IsGroupClosed -> [TcId] -> TcM a -> TcM a #

tcExtendSigIds :: TopLevelFlag -> [TcId] -> TcM a -> TcM a #

tcExtendRecIds :: [(Name, TcId)] -> TcM a -> TcM a #

tcExtendIdEnv :: [TcId] -> TcM a -> TcM a #

tcExtendIdEnv1 :: Name -> TcId -> TcM a -> TcM a #

tcExtendIdEnv2 :: [(Name, TcId)] -> TcM a -> TcM a #

tcExtendBinderStack :: [TcBinder] -> TcM a -> TcM a #

tcExtendLocalTypeEnv :: TcLclEnv -> [(Name, TcTyThing)] -> TcLclEnv #

isTypeClosedLetBndr :: Id -> Bool #

tcLookup :: Name -> TcM TcTyThing #

tcLookupLocated :: Located Name -> TcM TcTyThing #

tcLookupLocalIds :: [Name] -> TcM [TcId] #

tcLookupId :: Name -> TcM Id #

tcLookupIdMaybe :: Name -> TcM (Maybe Id) #

tcLookupTyVar :: Name -> TcM TcTyVar #

tcLookupTcTyCon :: HasDebugCallStack => Name -> TcM TcTyCon #

tcLookupLcl_maybe :: Name -> TcM (Maybe TcTyThing) #

getInLocalScope :: TcM (Name -> Bool) #

wrongThingErr :: String -> TcTyThing -> Name -> TcM a #

pprBinders :: [Name] -> SDoc #

tcAddDataFamConPlaceholders :: [LInstDecl GhcRn] -> TcM a -> TcM a #

tcAddPatSynPlaceholders :: [PatSynBind GhcRn GhcRn] -> TcM a -> TcM a #

getTypeSigNames :: [LSig GhcRn] -> NameSet #

tcExtendRecEnv :: [(Name, TyThing)] -> TcM r -> TcM r #

tcInitTidyEnv :: TcM TidyEnv #

tcInitOpenTidyEnv :: [TyCoVar] -> TcM TidyEnv #

Get a `TidyEnv` that includes mappings for all vars free in the given type. Useful when tidying open types.

tcLookupInstance :: Class -> [Type] -> TcM ClsInst #

tcGetInstEnvs :: TcM InstEnvs #

tcExtendRules :: [LRuleDecl GhcTc] -> TcM a -> TcM a #

tcGetDefaultTys :: TcM ([Type], (Bool, Bool)) #

checkWellStaged :: SDoc -> ThLevel -> ThLevel -> TcM () #

tcMetaTy :: Name -> TcM Type #

thLevel :: ThStage -> ThLevel #

topIdLvl :: Id -> ThLevel #

isBrackStage :: ThStage -> Bool #

newDFunName :: Class -> [Type] -> SrcSpan -> TcM Name #

Make a name for the dict fun for an instance decl. It's an *external* name, like other top-level names, and hence must be made with newGlobalBinder.

newFamInstTyConName :: Located Name -> [Type] -> TcM Name #

newFamInstAxiomName :: Located Name -> [[Type]] -> TcM Name #

mkStableIdFromString :: String -> Type -> SrcSpan -> (OccName -> OccName) -> TcM TcId #

mkStableIdFromName :: Name -> Type -> SrcSpan -> (OccName -> OccName) -> TcM TcId #

mkWrapperName :: (MonadIO m, HasDynFlags m, HasModule m) => String -> String -> m FastString #

# Orphan instances

MonadThings (IOEnv (Env TcGblEnv TcLclEnv)) # |
Instance details Methods lookupThing :: Name -> IOEnv (Env TcGblEnv TcLclEnv) TyThing # lookupId :: Name -> IOEnv (Env TcGblEnv TcLclEnv) Id # lookupDataCon :: Name -> IOEnv (Env TcGblEnv TcLclEnv) DataCon # lookupTyCon :: Name -> IOEnv (Env TcGblEnv TcLclEnv) TyCon #