ghc-8.2.2: 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 #

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])) #

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])) #

lookupExactOcc :: Name -> RnM Name #

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

reportUnboundName :: RdrName -> RnM Name #

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

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

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

data HsSigCtxt #

Constructors

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

Instances

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

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

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

lookupSigCtxtOccRn #

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 #

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

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

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 #

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' #

Arguments

:: Name | The standard name
-> RnM Name | Possibly a non-standard 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) #

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

dataTcOccs :: RdrName -> [RdrName] #

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

perhapsForallMsg :: SDoc #

unknownSubordinateErr :: SDoc -> RdrName -> SDoc #

data HsDocContext #

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 #

inHsDocContext :: HsDocContext -> SDoc #

withHsDocContext :: HsDocContext -> SDoc -> SDoc #