RnEnv

ghc-8.2.1.20171108: The GHC API

Safe Haskell | None
Language | Haskell2010

RnEnv

Synopsis

- newTopSrcBinder :: Located RdrName -> RnM Name
- lookupLocatedTopBndrRn :: Located RdrName -> RnM (Located Name)
- lookupTopBndrRn :: RdrName -> RnM Name
- lookupLocatedOccRn :: Located RdrName -> RnM (Located Name)
- lookupOccRn :: RdrName -> RnM Name
- lookupOccRn_maybe :: RdrName -> RnM (Maybe Name)
- lookupLocalOccRn_maybe :: RdrName -> RnM (Maybe Name)
- lookupInfoOccRn :: RdrName -> RnM [Name]
- lookupLocalOccThLvl_maybe :: Name -> RnM (Maybe (TopLevelFlag, ThLevel))
- lookupTypeOccRn :: RdrName -> RnM Name
- lookupKindOccRn :: RdrName -> RnM Name
- lookupGlobalOccRn :: RdrName -> RnM Name
- lookupGlobalOccRn_maybe :: RdrName -> RnM (Maybe Name)
- lookupOccRn_overloaded :: Bool -> RdrName -> RnM (Maybe (Either Name [FieldOcc Name]))
- lookupGlobalOccRn_overloaded :: Bool -> RdrName -> RnM (Maybe (Either Name [FieldOcc Name]))
- lookupExactOcc :: Name -> RnM Name
- reportUnboundName :: RdrName -> RnM Name
- unknownNameSuggestions :: DynFlags -> GlobalRdrEnv -> LocalRdrEnv -> ImportAvails -> RdrName -> SDoc
- addNameClashErrRn :: RdrName -> [GlobalRdrElt] -> RnM ()
- data HsSigCtxt
  - = TopSigCtxt NameSet
  - | LocalBindCtxt NameSet
  - | ClsDeclCtxt Name
  - | InstDeclCtxt NameSet
  - | HsBootCtxt NameSet
  - | RoleAnnotCtxt NameSet
- lookupLocalTcNames :: HsSigCtxt -> SDoc -> RdrName -> RnM [(RdrName, Name)]
- lookupSigOccRn :: HsSigCtxt -> Sig RdrName -> Located RdrName -> RnM (Located Name)
- lookupSigCtxtOccRn :: HsSigCtxt -> SDoc -> Located RdrName -> RnM (Located Name)
- lookupFixityRn :: Name -> RnM Fixity
- lookupFixityRn_help :: Name -> RnM (Bool, Fixity)
- lookupFieldFixityRn :: AmbiguousFieldOcc Name -> RnM Fixity
- lookupTyFixityRn :: Located Name -> RnM Fixity
- lookupInstDeclBndr :: Name -> SDoc -> RdrName -> RnM Name
- lookupRecFieldOcc :: Maybe Name -> SDoc -> RdrName -> RnM Name
- lookupFamInstName :: Maybe Name -> Located RdrName -> RnM (Located Name)
- lookupConstructorFields :: Name -> RnM [FieldLabel]
- lookupSyntaxName :: Name -> RnM (SyntaxExpr Name, FreeVars)
- lookupSyntaxName' :: Name -> RnM Name
- lookupSyntaxNames :: [Name] -> RnM ([HsExpr Name], FreeVars)
- lookupIfThenElse :: RnM (Maybe (SyntaxExpr Name), FreeVars)
- lookupGreAvailRn :: RdrName -> RnM (Name, AvailInfo)
- getLookupOccRn :: RnM (Name -> Maybe Name)
- mkUnboundName :: OccName -> Name
- mkUnboundNameRdr :: RdrName -> Name
- isUnboundName :: Name -> Bool
- addUsedGRE :: Bool -> GlobalRdrElt -> RnM ()
- addUsedGREs :: [GlobalRdrElt] -> RnM ()
- addUsedDataCons :: GlobalRdrEnv -> TyCon -> RnM ()
- newLocalBndrRn :: Located RdrName -> RnM Name
- newLocalBndrsRn :: [Located RdrName] -> RnM [Name]
- bindLocalNames :: [Name] -> RnM a -> RnM a
- bindLocalNamesFV :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
- type MiniFixityEnv = FastStringEnv (Located Fixity)
- addLocalFixities :: MiniFixityEnv -> [Name] -> RnM a -> RnM a
- bindLocatedLocalsFV :: [Located RdrName] -> ([Name] -> RnM (a, FreeVars)) -> RnM (a, FreeVars)
- bindLocatedLocalsRn :: [Located RdrName] -> ([Name] -> RnM a) -> RnM a
- extendTyVarEnvFVRn :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
- type RoleAnnotEnv = NameEnv (LRoleAnnotDecl Name)
- emptyRoleAnnotEnv :: RoleAnnotEnv
- mkRoleAnnotEnv :: [LRoleAnnotDecl Name] -> RoleAnnotEnv
- lookupRoleAnnot :: RoleAnnotEnv -> Name -> Maybe (LRoleAnnotDecl Name)
- getRoleAnnots :: [Name] -> RoleAnnotEnv -> ([LRoleAnnotDecl Name], RoleAnnotEnv)
- checkDupRdrNames :: [Located RdrName] -> RnM ()
- checkShadowedRdrNames :: [Located RdrName] -> RnM ()
- checkDupNames :: [Name] -> RnM ()
- checkDupAndShadowedNames :: (GlobalRdrEnv, LocalRdrEnv) -> [Name] -> RnM ()
- dupNamesErr :: Outputable n => (n -> SrcSpan) -> [n] -> RnM ()
- checkTupSize :: Int -> RnM ()
- addFvRn :: FreeVars -> RnM (thing, FreeVars) -> RnM (thing, FreeVars)
- mapFvRn :: (a -> RnM (b, FreeVars)) -> [a] -> RnM ([b], FreeVars)
- mapMaybeFvRn :: (a -> RnM (b, FreeVars)) -> Maybe a -> RnM (Maybe b, FreeVars)
- mapFvRnCPS :: (a -> (b -> RnM c) -> RnM c) -> [a] -> ([b] -> RnM c) -> RnM c
- warnUnusedMatches :: [Name] -> FreeVars -> RnM ()
- warnUnusedTypePatterns :: [Name] -> FreeVars -> RnM ()
- warnUnusedTopBinds :: [GlobalRdrElt] -> RnM ()
- warnUnusedLocalBinds :: [Name] -> FreeVars -> RnM ()
- mkFieldEnv :: GlobalRdrEnv -> NameEnv (FieldLabelString, Name)
- dataTcOccs :: RdrName -> [RdrName]
- kindSigErr :: Outputable a => a -> SDoc
- perhapsForallMsg :: SDoc
- unknownSubordinateErr :: SDoc -> RdrName -> SDoc
- data HsDocContext
  - = TypeSigCtx SDoc
  - | PatCtx
  - | SpecInstSigCtx
  - | DefaultDeclCtx
  - | ForeignDeclCtx (Located RdrName)
  - | DerivDeclCtx
  - | RuleCtx FastString
  - | TyDataCtx (Located RdrName)
  - | TySynCtx (Located RdrName)
  - | TyFamilyCtx (Located RdrName)
  - | FamPatCtx (Located RdrName)
  - | ConDeclCtx [Located Name]
  - | ClassDeclCtx (Located RdrName)
  - | ExprWithTySigCtx
  - | TypBrCtx
  - | HsTypeCtx
  - | GHCiCtx
  - | SpliceTypeCtx (LHsType RdrName)
  - | ClassInstanceCtx
  - | VectDeclCtx (Located RdrName)
  - | GenericCtx SDoc
- pprHsDocContext :: HsDocContext -> SDoc
- inHsDocContext :: HsDocContext -> SDoc
- withHsDocContext :: HsDocContext -> SDoc -> SDoc

# Documentation

newTopSrcBinder :: Located RdrName -> RnM Name Source #

lookupLocatedTopBndrRn :: Located RdrName -> RnM (Located Name) Source #

lookupTopBndrRn :: RdrName -> RnM Name Source #

lookupLocatedOccRn :: Located RdrName -> RnM (Located Name) Source #

lookupOccRn :: RdrName -> RnM Name Source #

lookupOccRn_maybe :: RdrName -> RnM (Maybe Name) Source #

lookupLocalOccRn_maybe :: RdrName -> RnM (Maybe Name) Source #

lookupInfoOccRn :: RdrName -> RnM [Name] Source #

lookupLocalOccThLvl_maybe :: Name -> RnM (Maybe (TopLevelFlag, ThLevel)) Source #

lookupTypeOccRn :: RdrName -> RnM Name Source #

lookupKindOccRn :: RdrName -> RnM Name Source #

lookupGlobalOccRn :: RdrName -> RnM Name Source #

lookupGlobalOccRn_maybe :: RdrName -> RnM (Maybe Name) Source #

lookupOccRn_overloaded :: Bool -> RdrName -> RnM (Maybe (Either Name [FieldOcc Name])) Source #

Like `lookupOccRn_maybe`, but with a more informative result if the `RdrName` happens to be a record selector:

- Nothing -> name not in scope (no error reported)
- Just (Left x) -> name uniquely refers to x, or there is a name clash (reported)
- Just (Right xs) -> name refers to one or more record selectors; if overload_ok was False, this list will be a singleton.

lookupGlobalOccRn_overloaded :: Bool -> RdrName -> RnM (Maybe (Either Name [FieldOcc Name])) Source #

lookupExactOcc :: Name -> RnM Name Source #

Lookup an `Exact` `RdrName`. See Note [Looking up Exact RdrNames]. This adds an error if the name cannot be found.

reportUnboundName :: RdrName -> RnM Name Source #

unknownNameSuggestions :: DynFlags -> GlobalRdrEnv -> LocalRdrEnv -> ImportAvails -> RdrName -> SDoc Source #

Called from the typechecker (TcErrors) when we find an unbound variable

addNameClashErrRn :: RdrName -> [GlobalRdrElt] -> RnM () Source #

data HsSigCtxt Source #

Constructors

TopSigCtxt NameSet |
LocalBindCtxt NameSet |
ClsDeclCtxt Name |
InstDeclCtxt NameSet |
HsBootCtxt NameSet |
RoleAnnotCtxt NameSet |

Instances

Outputable HsSigCtxt # |
Methods ppr :: HsSigCtxt -> SDoc Source # pprPrec :: Rational -> HsSigCtxt -> SDoc Source #

lookupLocalTcNames :: HsSigCtxt -> SDoc -> RdrName -> RnM [(RdrName, Name)] Source #

lookupSigOccRn :: HsSigCtxt -> Sig RdrName -> Located RdrName -> RnM (Located Name) Source #

lookupSigCtxtOccRn Source #

Arguments

:: HsSigCtxt |
-> SDoc | description of thing we're looking up, like "type family"
-> Located RdrName |
-> RnM (Located Name) |

Lookup a name in relation to the names in a `HsSigCtxt`

lookupFixityRn :: Name -> RnM Fixity Source #

lookupFixityRn_help :: Name -> RnM (Bool, Fixity) Source #

`lookupFixityRn_help` returns `(True, fixity)` if it finds a `Fixity` in a local environment or from an interface file. Otherwise, it returns `(False, fixity)` (e.g., for unbound `Name`s or `Name`s without user-supplied fixity declarations).

lookupFieldFixityRn :: AmbiguousFieldOcc Name -> RnM Fixity Source #

Look up the fixity of a (possibly ambiguous) occurrence of a record field selector. We use `lookupFixityRn'` so that we can specifiy the `OccName` as the field label, which might be different to the `OccName` of the selector `Name` if `DuplicateRecordFields` is in use (Trac #1173). If there are multiple possible selectors with different fixities, generate an error.

lookupTyFixityRn :: Located Name -> RnM Fixity Source #

lookupInstDeclBndr :: Name -> SDoc -> RdrName -> RnM Name Source #

lookupRecFieldOcc :: Maybe Name -> SDoc -> RdrName -> RnM Name Source #

lookupFamInstName :: Maybe Name -> Located RdrName -> RnM (Located Name) Source #

lookupConstructorFields :: Name -> RnM [FieldLabel] Source #

lookupSyntaxName :: Name -> RnM (SyntaxExpr Name, FreeVars) Source #

lookupSyntaxName' Source #

Arguments

:: Name | The standard name
-> RnM Name | Possibly a non-standard name

lookupSyntaxNames :: [Name] -> RnM ([HsExpr Name], FreeVars) Source #

lookupIfThenElse :: RnM (Maybe (SyntaxExpr Name), FreeVars) Source #

lookupGreAvailRn :: RdrName -> RnM (Name, AvailInfo) Source #

getLookupOccRn :: RnM (Name -> Maybe Name) Source #

mkUnboundName :: OccName -> Name Source #

mkUnboundNameRdr :: RdrName -> Name Source #

isUnboundName :: Name -> Bool Source #

addUsedGRE :: Bool -> GlobalRdrElt -> RnM () Source #

addUsedGREs :: [GlobalRdrElt] -> RnM () Source #

addUsedDataCons :: GlobalRdrEnv -> TyCon -> RnM () Source #

newLocalBndrRn :: Located RdrName -> RnM Name Source #

newLocalBndrsRn :: [Located RdrName] -> RnM [Name] Source #

bindLocalNames :: [Name] -> RnM a -> RnM a Source #

bindLocalNamesFV :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars) Source #

type MiniFixityEnv = FastStringEnv (Located Fixity) Source #

addLocalFixities :: MiniFixityEnv -> [Name] -> RnM a -> RnM a Source #

bindLocatedLocalsFV :: [Located RdrName] -> ([Name] -> RnM (a, FreeVars)) -> RnM (a, FreeVars) Source #

bindLocatedLocalsRn :: [Located RdrName] -> ([Name] -> RnM a) -> RnM a Source #

extendTyVarEnvFVRn :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars) Source #

type RoleAnnotEnv = NameEnv (LRoleAnnotDecl Name) Source #

emptyRoleAnnotEnv :: RoleAnnotEnv Source #

mkRoleAnnotEnv :: [LRoleAnnotDecl Name] -> RoleAnnotEnv Source #

lookupRoleAnnot :: RoleAnnotEnv -> Name -> Maybe (LRoleAnnotDecl Name) Source #

getRoleAnnots :: [Name] -> RoleAnnotEnv -> ([LRoleAnnotDecl Name], RoleAnnotEnv) Source #

checkDupRdrNames :: [Located RdrName] -> RnM () Source #

checkShadowedRdrNames :: [Located RdrName] -> RnM () Source #

checkDupNames :: [Name] -> RnM () Source #

checkDupAndShadowedNames :: (GlobalRdrEnv, LocalRdrEnv) -> [Name] -> RnM () Source #

dupNamesErr :: Outputable n => (n -> SrcSpan) -> [n] -> RnM () Source #

checkTupSize :: Int -> RnM () Source #

addFvRn :: FreeVars -> RnM (thing, FreeVars) -> RnM (thing, FreeVars) Source #

mapFvRn :: (a -> RnM (b, FreeVars)) -> [a] -> RnM ([b], FreeVars) Source #

mapMaybeFvRn :: (a -> RnM (b, FreeVars)) -> Maybe a -> RnM (Maybe b, FreeVars) Source #

mapFvRnCPS :: (a -> (b -> RnM c) -> RnM c) -> [a] -> ([b] -> RnM c) -> RnM c Source #

warnUnusedMatches :: [Name] -> FreeVars -> RnM () Source #

warnUnusedTypePatterns :: [Name] -> FreeVars -> RnM () Source #

warnUnusedTopBinds :: [GlobalRdrElt] -> RnM () Source #

warnUnusedLocalBinds :: [Name] -> FreeVars -> RnM () Source #

mkFieldEnv :: GlobalRdrEnv -> NameEnv (FieldLabelString, Name) Source #

Make a map from selector names to field labels and parent tycon names, to be used when reporting unused record fields.

dataTcOccs :: RdrName -> [RdrName] Source #

kindSigErr :: Outputable a => a -> SDoc Source #

perhapsForallMsg :: SDoc Source #

unknownSubordinateErr :: SDoc -> RdrName -> SDoc Source #

data HsDocContext Source #

Constructors

TypeSigCtx SDoc |
PatCtx |
SpecInstSigCtx |
DefaultDeclCtx |
ForeignDeclCtx (Located RdrName) |
DerivDeclCtx |
RuleCtx FastString |
TyDataCtx (Located RdrName) |
TySynCtx (Located RdrName) |
TyFamilyCtx (Located RdrName) |
FamPatCtx (Located RdrName) |
ConDeclCtx [Located Name] |
ClassDeclCtx (Located RdrName) |
ExprWithTySigCtx |
TypBrCtx |
HsTypeCtx |
GHCiCtx |
SpliceTypeCtx (LHsType RdrName) |
ClassInstanceCtx |
VectDeclCtx (Located RdrName) |
GenericCtx SDoc |

pprHsDocContext :: HsDocContext -> SDoc Source #

inHsDocContext :: HsDocContext -> SDoc Source #

withHsDocContext :: HsDocContext -> SDoc -> SDoc Source #