ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
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 #

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 # show :: Unique -> String # showList :: [Unique] -> ShowS #
Uniquable Unique # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique #
Outputable Unique # |
Instance details Defined in GHC.Types.Unique Methods ppr :: Unique -> SDoc #
Eq Unique # |
Instance details Defined in GHC.Types.Unique Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #

class Uniquable a where #

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

Methods

getUnique :: a -> Unique #

#### Instances

Instances details

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

uNIQUE_BITS :: Int #

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

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

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

mkTag :: 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.

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 #

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 #

minLocalUnique :: Unique #

maxLocalUnique :: Unique #