HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Rename.Env

  • 3 types
  • 49 values
  • Packageghc-9.10.3
  • Exports52
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceEnv.hs
valuelookupInfoOccRn :: RdrName -> RnM [Name]
#

lookupInfoOccRn is intended for use in GHCi's ":info" command It finds all the GREs that RdrName could mean, not complaining about ambiguity, but rather returning them all (c.f. #9881).

lookupInfoOccRn is also used in situations where we check for at least one definition of the RdrName, not complaining about multiple definitions (see #17832).

Look up a RdrName used as a variable in an expression.

This may be a local variable, global variable, or one or more record selector functions. It will not return record fields created with the NoFieldSelectors extension (see Note [NoFieldSelectors]).

If the name is not in scope at the term level, but its promoted equivalent is in scope at the type level, the lookup will succeed (so that the type-checker can report a more informative error later). See Note [Promotion].

Look up an occurrence of a field in record construction or pattern matching (but not update).

If -XDisambiguateRecordFields is off, then we will pass Nothing for the DataCon Name, i.e. we don't use the data constructor for disambiguation. See Note [DisambiguateRecordFields] and Note [NoFieldSelectors].

Returns all possible collections of field labels for the given record update.

Example:

data D = MkD { fld1 :: Int, fld2 :: Bool } data E = MkE1 { fld1 :: Int, fld2 :: Bool, fld3 :: Char } | MkE2 { fld1 :: Int, fld2 :: Bool } data F = MkF1 { fld1 :: Int } | MkF2 { fld2 :: Bool }

f r = r { fld1 = a, fld2 = b }

This function will return:

[ D.fld1, D.fld2

-- could be a record update at type D , [ E.fld1, E.fld2 ] -- could be a record update at type E ] -- cannot be a record update at type F: no constructor has both -- of the fields fld1 and fld2

If there are no valid parents for the record update, throws a TcRnBadRecordUpdate error.

valuelookupSyntaxName
  1. :: Name

    The standard name

  2. -> RnM (Name, FreeVars)

    Possibly a non-standard name Lookup a Name that may be subject to Rebindable Syntax (RS).

    • When RS is off, just return the supplied (standard) Name

    • When RS is on, look up the OccName of the supplied Name; return what we find, or the supplied Name if there is nothing in scope

#