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.Unique.Supply

  • 2 types
  • 1 class
  • 10 values
  • Packageghc-9.10.3
  • Exports13
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceSupply.hs

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 purely 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

Instances6Monad, Functor, MonadFix, MonadFail, Applicative, MonadUnique
classclass Monad m => MonadUnique (m :: Type -> Type) where
#

A monad for generating unique identifiers

Methods

Instances14MonadUnique, …

Operations on the monad

Set supply strategy

1 declaration