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 #

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 # pprPrec :: Rational -> Unique -> SDoc #
Uniquable Unique # |
Methods getUnique :: Unique -> Unique #

class Uniquable a where #

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

Minimal complete definition

getUnique

Methods

getUnique :: a -> Unique #

Instances

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

deriveUnique :: Unique -> Int -> Unique #

newTagUnique :: Unique -> Char -> Unique #

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

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 #

## Deriving uniques

### From TyCon name uniques

tyConRepNameUnique :: Unique -> Unique #

### From DataCon name uniques

dataConWorkerUnique :: Unique -> Unique #

dataConRepNameUnique :: Unique -> Unique #