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.Types.Var.Set

  • 9 types
  • 64 values
  • Packageghc-9.10.3
  • Exports73
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceSet.hs

Var, Id and TyVar set types

5 declarations
typetype VarSet = UniqSet Var
#

A non-deterministic Variable Set

A non-deterministic set of variables. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DVarSet if the set eventually gets converted into a list or folded over in a way where the order changes the generated code, for example when abstracting variables.

Manipulating these sets

valuepluralVarSet :: VarSet -> SDoc
#

Determines the pluralisation suffix appropriate for the length of a set in the same way that plural from Outputable does for lists.

valuepprVarSet
  1. :: VarSet

    The things to be pretty printed

  2. -> ([Var] -> SDoc)

    The pretty printing function to use on the elements

  3. -> SDoc

    SDoc where the things have been pretty printed

#

Pretty-print a non-deterministic set. The order of variables is non-deterministic and for pretty-printing that shouldn't be a problem. Having this function helps contain the non-determinism created with nonDetEltsUFM. Passing a list to the pretty-printing function allows the caller to decide on the order of Vars (eg. toposort them) without them having to use nonDetEltsUFM at the call site. This prevents from let-binding non-deterministically ordered lists and reusing them where determinism matters.

Deterministic Var set types

4 declarations

Manipulating these sets