HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Moduleghc-lib-parser-9.14.1.20251220GHC2021

GHC.Types.Var.Set

Contents
  1. Var, Id and TyVar set types
  2. Manipulating these sets
  3. Deterministic Var set types
  4. Manipulating these sets
Synopsis

Var, Id and TyVar set types

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

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

Manipulating these sets