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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Main data type

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

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