HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Main data types

newtypenewtype Unique

Unique identifier.

The type of unique identifiers that are used in many places in GHC for fast ordering and equality tests. You should generate these with the functions from the UniqSupply module

These are sometimes also referred to as "keys" in comments in GHC.

Instances4Eq, Show, Uniquable, Outputable
  • Eq UniqueDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique
  • Show UniqueDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique
  • Uniquable UniqueDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique
  • Outputable UniqueDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Unique
classclass Uniquable a where

Class of things that we can obtain a Unique from

Methods

Instances33Uniquable, …

Constructors, destructors and operations on Uniques

valuemkTag :: Char -> Word64

Put the character in the highest bits of the Word64. This may truncate the character to 8. This function is used in mkSplitUniqSupply so that it can precompute and share the tag part of the uniques it generates.

The interface file symbol-table encoding assumes that known-key uniques fit in 30-bits; verify this.

See Note [Symbol table representation of names] in GHC.Iface.Binary for details.

Local uniques

These are exposed exclusively for use by uniqAway, which has rather peculiar needs. See Note [Local uniques].