Unique

ghc-8.6.3: 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
  - 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
- deriveUnique :: Unique -> Int -> Unique
- newTagUnique :: Unique -> Char -> Unique
- initTyVarUnique :: Unique
- initExitJoinUnique :: 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
- 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
- dataConTyRepNameUnique :: Unique -> 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

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

class Uniquable a where #

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

Methods

getUnique :: a -> Unique #

Instances

Uniquable Int # |
Instance details Defined in Unique Methods getUnique :: Int -> Unique #
Uniquable Name # |
Instance details Defined in Name Methods getUnique :: Name -> Unique #
Uniquable OccName # |
Instance details Defined in OccName Methods getUnique :: OccName -> Unique #
Uniquable TyCon # |
Instance details Defined in TyCon Methods getUnique :: TyCon -> Unique #
Uniquable FastString # |
Instance details Defined in Unique Methods getUnique :: FastString -> Unique #
Uniquable ComponentId # |
Instance details Defined in Module Methods getUnique :: ComponentId -> Unique #
Uniquable InstalledUnitId # |
Instance details Defined in Module Methods getUnique :: InstalledUnitId -> Unique #
Uniquable UnitId # |
Instance details Defined in Module Methods getUnique :: UnitId -> Unique #
Uniquable ModuleName # |
Instance details Defined in Module Methods getUnique :: ModuleName -> Unique #
Uniquable Module # |
Instance details Defined in Module Methods getUnique :: Module -> Unique #
Uniquable Unique # |
Instance details Defined in Unique Methods getUnique :: Unique -> Unique #
Uniquable RegClass # |
Instance details Defined in RegClass Methods getUnique :: RegClass -> Unique #
Uniquable Reg # | so we can put regs in UniqSets
Instance details Defined in RegAlloc.Graph.ArchBase Methods getUnique :: Reg -> Unique #
Uniquable Reg # |
Instance details Defined in Reg Methods getUnique :: Reg -> Unique #
Uniquable RealReg # |
Instance details Defined in Reg Methods getUnique :: RealReg -> Unique #
Uniquable VirtualReg # |
Instance details Defined in Reg Methods getUnique :: VirtualReg -> Unique #
Uniquable PackageName # |
Instance details Defined in PackageConfig Methods getUnique :: PackageName -> Unique #
Uniquable SourcePackageId # |
Instance details Defined in PackageConfig Methods getUnique :: SourcePackageId -> Unique #
Uniquable Var # |
Instance details Defined in Var Methods getUnique :: Var -> Unique #
Uniquable PatSyn # |
Instance details Defined in PatSyn Methods getUnique :: PatSyn -> Unique #
Uniquable DataCon # |
Instance details Defined in DataCon Methods getUnique :: DataCon -> Unique #
Uniquable ConLike # |
Instance details Defined in ConLike Methods getUnique :: ConLike -> Unique #
Uniquable CoAxiomRule # |
Instance details Defined in CoAxiom Methods getUnique :: CoAxiomRule -> Unique #
Uniquable Class # |
Instance details Defined in Class Methods getUnique :: Class -> Unique #
Uniquable Label # |
Instance details Defined in Hoopl.Label Methods getUnique :: Label -> Unique #
Uniquable LocalReg # |
Instance details Defined in CmmExpr Methods getUnique :: LocalReg -> Unique #
Uniquable EvBindsVar # |
Instance details Defined in TcEvidence Methods getUnique :: EvBindsVar -> Unique #
Uniquable name => Uniquable (AnnTarget name) # |
Instance details Defined in Annotations Methods getUnique :: AnnTarget name -> Unique #
Uniquable (CoAxiom br) # |
Instance details Defined in CoAxiom Methods getUnique :: CoAxiom br -> Unique #

uNIQUE_BITS :: Int #

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

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 #

deriveUnique :: Unique -> Int -> Unique #

newTagUnique :: Unique -> Char -> Unique #

initTyVarUnique :: Unique #

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

## Making built-in uniques

mkAlphaTyVarUnique :: Int -> Unique #

mkPrimOpIdUnique :: Int -> Unique #

mkPreludeMiscIdUnique :: Int -> Unique #

mkPreludeDataConUnique :: Arity -> Unique #

mkPreludeTyConUnique :: Int -> Unique #

mkPreludeClassUnique :: 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 #

## Deriving uniques

### From TyCon name uniques

tyConRepNameUnique :: Unique -> Unique #

### From DataCon name uniques

dataConWorkerUnique :: Unique -> Unique #

dataConTyRepNameUnique :: Unique -> Unique #