Unique

ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

Unique

Contents

- Main data types
  - Constructors, destructors and operations on `Unique`s
  - Making built-in uniques
  - Deriving uniques
    - From TyCon name uniques
    - From DataCon name uniques

Synopsis

- data Unique
- class Uniquable a where
- 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)
- deriveUnique :: Unique -> Int -> Unique
- newTagUnique :: Unique -> Char -> Unique
- initTyVarUnique :: Unique
- nonDetCmpUnique :: Unique -> Unique -> Ordering
- isValidKnownKeyUnique :: Unique -> Bool
- mkAlphaTyVarUnique :: Int -> Unique
- mkPrimOpIdUnique :: Int -> Unique
- mkPreludeMiscIdUnique :: Int -> Unique
- mkPreludeDataConUnique :: Arity -> Unique
- mkPreludeTyConUnique :: Int -> Unique
- mkPreludeClassUnique :: Int -> Unique
- mkPArrDataConUnique :: Int -> Unique
- mkCoVarUnique :: Int -> Unique
- mkVarOccUnique :: FastString -> Unique
- mkDataOccUnique :: FastString -> Unique
- mkTvOccUnique :: FastString -> Unique
- mkTcOccUnique :: FastString -> Unique
- mkRegSingleUnique :: Int -> Unique
- mkRegPairUnique :: Int -> Unique
- mkRegClassUnique :: Int -> Unique
- mkRegSubUnique :: Int -> Unique
- mkCostCentreUnique :: Int -> Unique
- mkBuiltinUnique :: Int -> Unique
- mkPseudoUniqueD :: Int -> Unique
- mkPseudoUniqueE :: Int -> Unique
- mkPseudoUniqueH :: Int -> Unique
- tyConRepNameUnique :: Unique -> Unique
- dataConWorkerUnique :: Unique -> Unique
- dataConRepNameUnique :: Unique -> 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

Eq Unique # |
Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #
Show Unique # |
Methods showsPrec :: Int -> Unique -> ShowS Source # show :: Unique -> String Source # showList :: [Unique] -> ShowS Source #
Outputable Unique # |
Methods ppr :: Unique -> SDoc Source # pprPrec :: Rational -> Unique -> SDoc Source #
Uniquable Unique # |
Methods getUnique :: Unique -> Unique Source #

class Uniquable a where Source #

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

Minimal complete definition

getUnique

Methods

getUnique :: a -> Unique Source #

Instances

Uniquable Int # |
Methods getUnique :: Int -> Unique Source #
Uniquable Name # |
Methods getUnique :: Name -> Unique Source #
Uniquable OccName # |
Methods getUnique :: OccName -> Unique Source #
Uniquable TyCon # |
Methods getUnique :: TyCon -> Unique Source #
Uniquable FastString # |
Methods getUnique :: FastString -> Unique Source #
Uniquable ComponentId # |
Methods getUnique :: ComponentId -> Unique Source #
Uniquable InstalledUnitId # |
Methods getUnique :: InstalledUnitId -> Unique Source #
Uniquable UnitId # |
Methods getUnique :: UnitId -> Unique Source #
Uniquable ModuleName # |
Methods getUnique :: ModuleName -> Unique Source #
Uniquable Module # |
Methods getUnique :: Module -> Unique Source #
Uniquable Unique # |
Methods getUnique :: Unique -> Unique Source #
Uniquable RegClass # |
Methods getUnique :: RegClass -> Unique Source #
Uniquable Reg # | so we can put regs in UniqSets
Methods getUnique :: Reg -> Unique Source #
Uniquable Reg # |
Methods getUnique :: Reg -> Unique Source #
Uniquable RealReg # |
Methods getUnique :: RealReg -> Unique Source #
Uniquable VirtualReg # |
Methods getUnique :: VirtualReg -> Unique Source #
Uniquable PackageName # |
Methods getUnique :: PackageName -> Unique Source #
Uniquable SourcePackageId # |
Methods getUnique :: SourcePackageId -> Unique Source #
Uniquable Var # |
Methods getUnique :: Var -> Unique Source #
Uniquable PatSyn # |
Methods getUnique :: PatSyn -> Unique Source #
Uniquable DataCon # |
Methods getUnique :: DataCon -> Unique Source #
Uniquable ConLike # |
Methods getUnique :: ConLike -> Unique Source #
Uniquable CoAxiomRule # |
Methods getUnique :: CoAxiomRule -> Unique Source #
Uniquable Class # |
Methods getUnique :: Class -> Unique Source #
Uniquable LocalReg # |
Methods getUnique :: LocalReg -> Unique Source #
Uniquable EvBindsVar # |
Methods getUnique :: EvBindsVar -> Unique Source #
Uniquable name => Uniquable (AnnTarget name) # |
Methods getUnique :: AnnTarget name -> Unique Source #
Uniquable (CoAxiom br) # |
Methods getUnique :: CoAxiom br -> 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 #

deriveUnique :: Unique -> Int -> Unique Source #

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

initTyVarUnique :: 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 BinIface for details.

## Making built-in uniques

mkAlphaTyVarUnique :: Int -> Unique Source #

mkPrimOpIdUnique :: Int -> Unique Source #

mkPreludeMiscIdUnique :: Int -> Unique Source #

mkPreludeDataConUnique :: Arity -> Unique Source #

mkPreludeTyConUnique :: Int -> Unique Source #

mkPreludeClassUnique :: Int -> Unique Source #

mkPArrDataConUnique :: Int -> Unique Source #

mkCoVarUnique :: Int -> Unique Source #

mkVarOccUnique :: FastString -> Unique Source #

mkDataOccUnique :: FastString -> Unique Source #

mkTvOccUnique :: FastString -> Unique Source #

mkTcOccUnique :: FastString -> Unique Source #

mkRegSingleUnique :: Int -> Unique Source #

mkRegPairUnique :: Int -> Unique Source #

mkRegClassUnique :: Int -> Unique Source #

mkRegSubUnique :: Int -> Unique Source #

mkCostCentreUnique :: Int -> Unique Source #

mkBuiltinUnique :: Int -> Unique Source #

mkPseudoUniqueD :: Int -> Unique Source #

mkPseudoUniqueE :: Int -> Unique Source #

mkPseudoUniqueH :: Int -> Unique Source #

## Deriving uniques

### From TyCon name uniques

tyConRepNameUnique :: Unique -> Unique Source #

### From DataCon name uniques

dataConWorkerUnique :: Unique -> Unique Source #

dataConRepNameUnique :: Unique -> Unique Source #