TcEnv

ghc-8.0.0.20160204: 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_closed :: TopLevelFlag
    }
  - | ATyVar Name TcTyVar
  - | ATcTyCon TyCon
  - | APromotionErr PromotionErr
- type TcId = Id
- data InstInfo a = InstInfo {
  - iSpec :: ClsInst
  - iBinds :: InstBindings a
  }
- iDFunId :: InstInfo a -> DFunId
- pprInstInfoDetails :: OutputableBndr a => InstInfo 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
- 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
- tcExtendKindEnv2 :: [(Name, TcTyThing)] -> TcM r -> TcM r
- tcExtendTyVarEnv :: [TyVar] -> TcM r -> TcM r
- tcExtendTyVarEnv2 :: [(Name, TcTyVar)] -> TcM r -> TcM r
- tcExtendLetEnv :: TopLevelFlag -> [TcId] -> TcM a -> TcM a
- tcExtendLetEnvIds :: TopLevelFlag -> [(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
- tcExtendIdBndrs :: [TcIdBinder] -> TcM a -> TcM a
- tcExtendLocalTypeEnv :: TcLclEnv -> [(Name, TcTyThing)] -> TcM TcLclEnv
- isClosedLetBndr :: Id -> TopLevelFlag
- tcLookup :: Name -> TcM TcTyThing
- tcLookupLocated :: Located Name -> TcM TcTyThing
- tcLookupLocalIds :: [Name] -> TcM [TcId]
- tcLookupId :: Name -> TcM Id
- tcLookupTyVar :: Name -> TcM TcTyVar
- tcLookupLcl_maybe :: Name -> TcM (Maybe TcTyThing)
- getScopedTyVarBinds :: TcM [(Name, TcTyVar)]
- getInLocalScope :: TcM (Name -> Bool)
- wrongThingErr :: String -> TcTyThing -> Name -> TcM a
- pprBinders :: [Name] -> SDoc
- tcAddDataFamConPlaceholders :: [LInstDecl Name] -> TcM a -> TcM a
- tcAddPatSynPlaceholders :: [PatSynBind Name Name] -> TcM a -> TcM a
- getPatSynBinds :: [(RecFlag, LHsBinds Name)] -> [PatSynBind Name Name]
- getTypeSigNames :: [LSig Name] -> NameSet
- tcExtendRecEnv :: [(Name, TyThing)] -> TcM r -> TcM r
- tcLookupInstance :: Class -> [Type] -> TcM ClsInst
- tcGetInstEnvs :: TcM InstEnvs
- tcExtendRules :: [LRuleDecl Id] -> TcM a -> TcM a
- tcGetDefaultTys :: TcM ([Type], (Bool, Bool))
- tcGetGlobalTyCoVars :: TcM TcTyVarSet
- checkWellStaged :: SDoc -> ThLevel -> ThLevel -> TcM ()
- tcMetaTy :: Name -> TcM Type
- thLevel :: ThStage -> ThLevel
- topIdLvl :: Id -> ThLevel
- isBrackStage :: ThStage -> Bool
- newLocalName :: Name -> TcM Name
- newDFunName :: Class -> [Type] -> SrcSpan -> TcM Name
- newDFunName' :: Class -> TyCon -> 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 Source

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

Eq TyThing |
Methods (==) :: TyThing -> TyThing -> Bool (/=) :: TyThing -> TyThing -> Bool
Ord TyThing |
Methods compare :: TyThing -> TyThing -> Ordering (<) :: TyThing -> TyThing -> Bool (<=) :: TyThing -> TyThing -> Bool (>) :: TyThing -> TyThing -> Bool (>=) :: TyThing -> TyThing -> Bool max :: TyThing -> TyThing -> TyThing min :: TyThing -> TyThing -> TyThing
Outputable TyThing |
Methods ppr :: TyThing -> SDoc Source pprPrec :: Rational -> TyThing -> SDoc Source
NamedThing TyThing |
Methods getOccName :: TyThing -> OccName Source getName :: TyThing -> Name Source

data TcTyThing Source

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_closed :: TopLevelFlag
ATyVar Name TcTyVar |
ATcTyCon TyCon |
APromotionErr PromotionErr |

Instances

Outputable TcTyThing |
Methods ppr :: TcTyThing -> SDoc Source pprPrec :: Rational -> TcTyThing -> SDoc Source

type TcId = Id Source

data InstInfo a Source

Constructors

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

Instances

OutputableBndr a => Outputable (InstInfo a) |
Methods ppr :: InstInfo a -> SDoc Source pprPrec :: Rational -> InstInfo a -> SDoc Source

iDFunId :: InstInfo a -> DFunId Source

pprInstInfoDetails :: OutputableBndr a => InstInfo a -> SDoc Source

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

simpleInstInfoTy :: InstInfo a -> Type Source

simpleInstInfoTyCon :: InstInfo a -> TyCon Source

data InstBindings a Source

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 Source

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

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

setGlobalTypeEnv :: TcGblEnv -> TypeEnv -> TcM TcGblEnv Source

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

tcLookupLocatedGlobal :: Located Name -> TcM TyThing Source

tcLookupGlobal :: Name -> TcM TyThing Source

tcLookupTyCon :: Name -> TcM TyCon Source

tcLookupClass :: Name -> TcM Class Source

tcLookupDataCon :: Name -> TcM DataCon Source

tcLookupPatSyn :: Name -> TcM PatSyn Source

tcLookupConLike :: Name -> TcM ConLike Source

tcLookupLocatedGlobalId :: Located Name -> TcM Id Source

tcLookupLocatedTyCon :: Located Name -> TcM TyCon Source

tcLookupLocatedClass :: Located Name -> TcM Class Source

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

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

tcExtendKindEnv2 :: [(Name, TcTyThing)] -> TcM r -> TcM r Source

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

tcExtendTyVarEnv2 :: [(Name, TcTyVar)] -> TcM r -> TcM r Source

tcExtendLetEnv :: TopLevelFlag -> [TcId] -> TcM a -> TcM a Source

tcExtendLetEnvIds :: TopLevelFlag -> [(Name, TcId)] -> TcM a -> TcM a Source

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

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

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

tcExtendIdBndrs :: [TcIdBinder] -> TcM a -> TcM a Source

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

isClosedLetBndr :: Id -> TopLevelFlag Source

tcLookup :: Name -> TcM TcTyThing Source

tcLookupLocated :: Located Name -> TcM TcTyThing Source

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

tcLookupId :: Name -> TcM Id Source

tcLookupTyVar :: Name -> TcM TcTyVar Source

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

getScopedTyVarBinds :: TcM [(Name, TcTyVar)] Source

getInLocalScope :: TcM (Name -> Bool) Source

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

pprBinders :: [Name] -> SDoc Source

tcAddDataFamConPlaceholders :: [LInstDecl Name] -> TcM a -> TcM a Source

tcAddPatSynPlaceholders :: [PatSynBind Name Name] -> TcM a -> TcM a Source

getPatSynBinds :: [(RecFlag, LHsBinds Name)] -> [PatSynBind Name Name] Source

getTypeSigNames :: [LSig Name] -> NameSet Source

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

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

tcGetInstEnvs :: TcM InstEnvs Source

tcExtendRules :: [LRuleDecl Id] -> TcM a -> TcM a Source

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

tcGetGlobalTyCoVars :: TcM TcTyVarSet Source

`tcGetGlobalTyCoVars` returns a fully-zonked set of *scoped* tyvars free in the environment. To improve subsequent calls to the same function it writes the zonked set back into the environment. Note that this returns all variables free in anything (term-level or type-level) in scope. We thus don't have to worry about clashes with things that are not in scope, because if they are reachable, then they'll be returned here.

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

tcMetaTy :: Name -> TcM Type Source

thLevel :: ThStage -> ThLevel Source

topIdLvl :: Id -> ThLevel Source

isBrackStage :: ThStage -> Bool Source

newLocalName :: Name -> TcM Name Source

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

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.

newDFunName' :: Class -> TyCon -> TcM Name Source

Special case of `newDFunName` to generate dict fun name for a single TyCon.

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

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

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

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

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

# Orphan instances

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