GHC.Types.Unique

ghc-9.2.0.20210422: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

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 :: Unique -> SDoc
- mkUniqueGrimily :: Int -> Unique
- getKey :: Unique -> Int
- mkUnique :: Char -> Int -> Unique
- unpkUnique :: Unique -> (Char, Int)
- eqUnique :: Unique -> Unique -> Bool
- ltUnique :: Unique -> Unique -> Bool
- incrUnique :: Unique -> Unique
- stepUnique :: Unique -> Int -> Unique
- newTagUnique :: Unique -> Char -> Unique
- nonDetCmpUnique :: Unique -> Unique -> Ordering
- isValidKnownKeyUnique :: Unique -> Bool
- mkLocalUnique :: Int -> 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

Show Unique # |
Instance details Defined in GHC.Types.Unique Methods showsPrec :: Int -> Unique -> ShowS Source # show :: Unique -> String Source # showList :: [Unique] -> ShowS Source #
Uniquable Unique # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique Source #
Outputable Unique # |
Instance details Defined in GHC.Types.Unique Methods ppr :: Unique -> SDoc Source #
Eq Unique # |
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 # |
Instance details Defined in GHC.Cmm.Dataflow.Label Methods getUnique :: Label -> Unique Source #
Uniquable LocalReg # |
Instance details Defined in GHC.Cmm.Expr Methods getUnique :: LocalReg -> Unique Source #
Uniquable Reg # | so we can put regs in UniqSets
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Base Methods getUnique :: Reg -> Unique Source #
Uniquable Class # |
Instance details Defined in GHC.Core.Class Methods getUnique :: Class -> Unique Source #
Uniquable CoAxiomRule # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiomRule -> Unique Source #
Uniquable ConLike # |
Instance details Defined in GHC.Core.ConLike Methods getUnique :: ConLike -> Unique Source #
Uniquable DataCon # |
Instance details Defined in GHC.Core.DataCon Methods getUnique :: DataCon -> Unique Source #
Uniquable PatSyn # |
Instance details Defined in GHC.Core.PatSyn Methods getUnique :: PatSyn -> Unique Source #
Uniquable CoercionHole # |
Instance details Defined in GHC.Core.TyCo.Rep Methods getUnique :: CoercionHole -> Unique Source #
Uniquable TyCon # |
Instance details Defined in GHC.Core.TyCon Methods getUnique :: TyCon -> Unique Source #
Uniquable FastString # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: FastString -> Unique Source #
Uniquable RealReg # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: RealReg -> Unique Source #
Uniquable Reg # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: Reg -> Unique Source #
Uniquable VirtualReg # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: VirtualReg -> Unique Source #
Uniquable RegClass # |
Instance details Defined in GHC.Platform.Reg.Class Methods getUnique :: RegClass -> Unique Source #
Uniquable EvBindsVar # |
Instance details Defined in GHC.Tc.Types.Evidence Methods getUnique :: EvBindsVar -> Unique Source #
Uniquable Name # |
Instance details Defined in GHC.Types.Name Methods getUnique :: Name -> Unique Source #
Uniquable OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: OccName -> Unique Source #
Uniquable Unique # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique Source #
Uniquable Var # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Uniquable PackageId # |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageId -> Unique Source #
Uniquable PackageName # |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageName -> Unique Source #
Uniquable ModuleName # |
Instance details Defined in GHC.Unit.Module.Name Methods getUnique :: ModuleName -> Unique Source #
Uniquable Module # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique Source #
Uniquable UnitId # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: UnitId -> Unique Source #
Uniquable Int # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Int -> Unique Source #
Uniquable (CoAxiom br) # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiom br -> Unique Source #
Uniquable unit => Uniquable (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Definite unit -> Unique Source #
IsUnitId u => Uniquable (GenUnit u) # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: GenUnit u -> Unique Source #
Uniquable unit => Uniquable (Indefinite unit) # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Indefinite unit -> Unique Source #

uNIQUE_BITS :: Int Source #

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

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

pprUniqueAlways :: Unique -> SDoc Source #

mkUniqueGrimily :: Int -> Unique Source #

getKey :: Unique -> Int Source #

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

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

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

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

incrUnique :: Unique -> Unique Source #

stepUnique :: Unique -> Int -> 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 :: Int -> Unique Source #

minLocalUnique :: Unique Source #

maxLocalUnique :: Unique Source #