HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Hs.Utils

Here we collect a variety of helper functions that construct or analyse HsSyn. All these functions deal with generic HsSyn; functions which deal with the instantiated versions are located elsewhere:

Parameterised by Module ---------------- ------------- GhcPs/RdrName GHC.Parser.PostProcess GhcRn/Name GHC.Rename.* GhcTc/Id GHC.Tc.Zonk.Type

The mk* functions attempt to construct a not-completely-useless SrcSpan from their components, compared with the nl* functions which just attach noSrcSpan to everything.

  • 4 types
  • 1 class
  • 150 values
  • Packageghc-9.10.3
  • Exports155
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceUtils.hs

Terms

60 declarations

Bindings

8 declarations

Literals

7 declarations

Patterns

20 declarations

Types

12 declarations

Stmts

16 declarations

Collecting binders

27 declarations

Should we treat this as an unlifted bind? This will be true for any bind that binds an unlifted variable, but we must be careful around AbsBinds. See Note [isUnliftedHsBind]. For usage information, see Note [Strict binds checks] is GHC.HsToCore.Binds.

classclass UnXRec p => CollectPass p where
#

This class specifies how to collect variable identifiers from extension patterns in the given pass. Consumers of the GHC API that define their own passes should feel free to implement instances in order to make use of functions which depend on it.

In particular, Haddock already makes use of this, with an instance for its DocNameI pass so that it can reuse the code in GHC for collecting binders.

Methods

Instances1CollectPass
datadata CollectFlag p where
#

Indicate if evidence binders and type variable binders have to be collected.

This type enumerates the modes of collecting bound variables | evidence | type | term | ghc | | binders | variables | variables | pass | -------------------------------------------- CollNoDictBinders | no | no | yes | any | CollWithDictBinders | yes | no | yes | GhcTc | CollVarTyVarBinders | no | yes | yes | GhcRn |

See Note [Dictionary binders in ConPatOut]

Constructors

Returns all the binding names of the decl. The first one is guaranteed to be the name of the decl. The first component represents all binding names except record fields; the second represents field occurrences. For record fields mentioned in multiple constructors, the SrcLoc will be from the first occurrence.

Each returned (Located name) has a SrcSpan for the whole declaration. See Note [SrcSpan for binders]

Collecting implicit binders

5 declarations

Collect all record wild card binders in the given pattern.

These are all the variables bound in all (possibly nested) record wildcard patterns appearing inside the pattern.

See Note [Collecting implicit binders].