HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Moduleghc-lib-parser-9.14.1.20251220GHC2021

GHC.Types.Unique.Supply

  • 2 types
  • 1 class
  • 10 values

Main data type

1 declaration
datadata UniqSupply
#

Unique Supply

A value of type UniqSupply is unique, and it can supply one distinct Unique. Also, from the supply, one can also manufacture an arbitrary number of further UniqueSupply values, which will be distinct from the first and from all others.

Operations on supplies

Create a unique supply out of thin air. The "tag" (Char) supplied is mostly cosmetic, making it easier to figure out where a Unique was born. See Note [Uniques and tags].

The payload part of the Uniques allocated from this UniqSupply are guaranteed distinct wrt all other supplies, regardless of their "tag". This is achieved by allocating the payload part from a single source of Uniques, namely genSym, shared across all UniqSupply's.

Unique supply monad and its abstraction

2 declarations
newtypenewtype UniqSM result
#

A monad which just gives the ability to obtain Uniques

Instances7Monad, Functor, MonadFix, MonadFail, Applicative, MonadGetUnique, …
  • Monad UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply
  • Functor UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply
  • MonadFix UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply
  • MonadFail UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply
  • Applicative UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply
  • MonadGetUnique UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.DSM
  • MonadUnique UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply
classclass Monad m => MonadUnique (m :: Type -> Type) where
#

A monad for generating unique identifiers

Methods

Instances3MonadUnique
  • MonadUnique CoreMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.Opt.Monad
  • MonadUnique SimplMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Core.Opt.Simplify.Monad
  • MonadUnique UniqSMDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique.Supply

Operations on the monad

Set supply strategy

1 declaration