ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Types.Unique

Contents

- Main data types
  - Constructors, destructors and operations on `Unique`s
  - Local uniques

Synopsis

- data Unique
- class Uniquable a where
  - getUnique :: a -> Unique
- uNIQUE_BITS :: Int
- hasKey :: Uniquable a => a -> Unique -> Bool
- pprUniqueAlways :: IsLine doc => Unique -> doc
- mkTag :: Char -> Word64
- mkUniqueGrimily :: Word64 -> Unique
- mkUniqueIntGrimily :: Int -> Unique
- getKey :: Unique -> Word64
- mkUnique :: Char -> Word64 -> Unique
- unpkUnique :: Unique -> (Char, Word64)
- mkUniqueInt :: Char -> Int -> Unique
- eqUnique :: Unique -> Unique -> Bool
- ltUnique :: Unique -> Unique -> Bool
- incrUnique :: Unique -> Unique
- stepUnique :: Unique -> Word64 -> Unique
- newTagUnique :: Unique -> Char -> Unique
- nonDetCmpUnique :: Unique -> Unique -> Ordering
- isValidKnownKeyUnique :: Unique -> Bool
- mkLocalUnique :: Word64 -> Unique
- minLocalUnique :: Unique
- maxLocalUnique :: Unique

# Main data types

data Unique Source #

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.

#### Instances

Instances details

Uniquable Unique Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique Source #
Outputable Unique Source # |
Instance details Defined in GHC.Types.Unique Methods ppr :: Unique -> SDoc Source #
Show Unique Source # |
Instance details Defined in GHC.Types.Unique Methods showsPrec :: Int -> Unique -> ShowS # show :: Unique -> String # showList :: [Unique] -> ShowS #
Eq Unique Source # |
Instance details Defined in GHC.Types.Unique Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #

class Uniquable a where Source #

Class of things that we can obtain a `Unique` from

Methods

getUnique :: a -> Unique Source #

#### Instances

Instances details

Uniquable Label Source # |
Instance details Defined in GHC.Cmm.Dataflow.Label Methods getUnique :: Label -> Unique Source #
Uniquable LocalReg Source # |
Instance details Defined in GHC.Cmm.Reg Methods getUnique :: LocalReg -> Unique Source #
Uniquable Reg Source # | so we can put regs in UniqSets
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Base Methods getUnique :: Reg -> Unique Source #
Uniquable SymName Source # |
Instance details Defined in GHC.CmmToAsm.Wasm.Types Methods getUnique :: SymName -> Unique Source #
Uniquable Class Source # |
Instance details Defined in GHC.Core.Class Methods getUnique :: Class -> Unique Source #
Uniquable CoAxiomRule Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiomRule -> Unique Source #
Uniquable ConLike Source # |
Instance details Defined in GHC.Core.ConLike Methods getUnique :: ConLike -> Unique Source #
Uniquable DataCon Source # |
Instance details Defined in GHC.Core.DataCon Methods getUnique :: DataCon -> Unique Source #
Uniquable PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods getUnique :: PatSyn -> Unique Source #
Uniquable CoercionHole Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods getUnique :: CoercionHole -> Unique Source #
Uniquable TyCon Source # |
Instance details Defined in GHC.Core.TyCon Methods getUnique :: TyCon -> Unique Source #
Uniquable FastString Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: FastString -> Unique Source #
Uniquable Ident Source # |
Instance details Defined in GHC.JS.Ident Methods getUnique :: Ident -> Unique Source #
Uniquable RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: RealReg -> Unique Source #
Uniquable Reg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: Reg -> Unique Source #
Uniquable VirtualReg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: VirtualReg -> Unique Source #
Uniquable RegClass Source # |
Instance details Defined in GHC.Platform.Reg.Class Methods getUnique :: RegClass -> Unique Source #
Uniquable EvBindsVar Source # |
Instance details Defined in GHC.Tc.Types.Evidence Methods getUnique :: EvBindsVar -> Unique Source #
Uniquable SkolemInfo Source # |
Instance details Defined in GHC.Tc.Types.Origin Methods getUnique :: SkolemInfo -> Unique Source #
Uniquable ConLikeName Source # |
Instance details Defined in GHC.Types.GREInfo Methods getUnique :: ConLikeName -> Unique Source #
Uniquable Name Source # |
Instance details Defined in GHC.Types.Name Methods getUnique :: Name -> Unique Source #
Uniquable NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: NameSpace -> Unique Source #
Uniquable Unique Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique Source #
Uniquable Var Source # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Uniquable PackageId Source # |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageId -> Unique Source #
Uniquable PackageName Source # |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageName -> Unique Source #
Uniquable WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods getUnique :: WarningCategory -> Unique Source #
Uniquable Module Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique Source #
Uniquable UnitId Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: UnitId -> Unique Source #
Uniquable FieldLabelString Source # |
Instance details Defined in GHC.Types.FieldLabel Methods getUnique :: FieldLabelString -> Unique Source #
Uniquable ModuleName Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: ModuleName -> Unique Source #
Uniquable Int Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Int -> Unique Source #
Uniquable (CoAxiom br) Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiom br -> Unique Source #
Uniquable unit => Uniquable (Definite unit) Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Definite unit -> Unique Source #
IsUnitId u => Uniquable (GenUnit u) Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: GenUnit u -> Unique Source #

uNIQUE_BITS :: Int Source #

## Constructors, destructors and operations on `Unique`s

hasKey :: Uniquable a => a -> Unique -> Bool Source #

pprUniqueAlways :: IsLine doc => Unique -> doc Source #

mkTag :: Char -> Word64 Source #

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.

mkUniqueGrimily :: Word64 -> Unique Source #

mkUniqueIntGrimily :: Int -> Unique Source #

getKey :: Unique -> Word64 Source #

mkUnique :: Char -> Word64 -> Unique Source #

unpkUnique :: Unique -> (Char, Word64) Source #

mkUniqueInt :: Char -> Int -> Unique Source #

eqUnique :: Unique -> Unique -> Bool Source #

ltUnique :: Unique -> Unique -> Bool Source #

incrUnique :: Unique -> Unique Source #

stepUnique :: Unique -> Word64 -> Unique Source #

newTagUnique :: Unique -> Char -> Unique Source #

nonDetCmpUnique :: Unique -> Unique -> Ordering Source #

isValidKnownKeyUnique :: Unique -> Bool Source #

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].

mkLocalUnique :: Word64 -> Unique Source #

minLocalUnique :: Unique Source #

maxLocalUnique :: Unique Source #