ghc-8.4.3: The GHC API

Safe HaskellNone
LanguageHaskell2010

UniqSupply

Contents

Synopsis

Main data type

data UniqSupply Source #

Unique Supply

A value of type UniqSupply is unique, and it can supply one distinct Unique. Also, from the supply, one can also manufacture an arbitrary number of further UniqueSupply values, which will be distinct from the first and from all others.

Operations on supplies

uniqFromSupply :: UniqSupply -> Unique Source #

Obtain the Unique from this particular UniqSupply

uniqsFromSupply :: UniqSupply -> [Unique] Source #

Obtain an infinite list of Unique that can be generated by constant splitting of the supply

takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply) Source #

Obtain the Unique from this particular UniqSupply, and a new supply

mkSplitUniqSupply :: Char -> IO UniqSupply Source #

Create a unique supply out of thin air. The character given must be distinct from those of all calls to this function in the compiler for the values generated to be truly unique.

splitUniqSupply :: UniqSupply -> (UniqSupply, UniqSupply) Source #

Build two UniqSupply from a single one, each of which can supply its own Unique.

listSplitUniqSupply :: UniqSupply -> [UniqSupply] Source #

Create an infinite list of UniqSupply from a single one

splitUniqSupply3 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply) Source #

Build three UniqSupply from a single one, each of which can supply its own unique

splitUniqSupply4 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply, UniqSupply) Source #

Build four UniqSupply from a single one, each of which can supply its own unique

Unique supply monad and its abstraction

data UniqSM result Source #

A monad which just gives the ability to obtain Uniques

Instances
Monad UniqSM Source # 
Instance details

Defined in UniqSupply

Methods

(>>=) :: UniqSM a -> (a -> UniqSM b) -> UniqSM b #

(>>) :: UniqSM a -> UniqSM b -> UniqSM b #

return :: a -> UniqSM a #

fail :: String -> UniqSM a #

Functor UniqSM Source # 
Instance details

Defined in UniqSupply

Methods

fmap :: (a -> b) -> UniqSM a -> UniqSM b #

(<$) :: a -> UniqSM b -> UniqSM a #

MonadFix UniqSM Source # 
Instance details

Defined in UniqSupply

Methods

mfix :: (a -> UniqSM a) -> UniqSM a #

Applicative UniqSM Source # 
Instance details

Defined in UniqSupply

Methods

pure :: a -> UniqSM a #

(<*>) :: UniqSM (a -> b) -> UniqSM a -> UniqSM b #

liftA2 :: (a -> b -> c) -> UniqSM a -> UniqSM b -> UniqSM c #

(*>) :: UniqSM a -> UniqSM b -> UniqSM b #

(<*) :: UniqSM a -> UniqSM b -> UniqSM a #

MonadUnique UniqSM Source # 
Instance details

Defined in UniqSupply

class Monad m => MonadUnique m where Source #

A monad for generating unique identifiers

Minimal complete definition

getUniqueSupplyM

Methods

getUniqueSupplyM :: m UniqSupply Source #

Get a new UniqueSupply

getUniqueM :: m Unique Source #

Get a new unique identifier

getUniquesM :: m [Unique] Source #

Get an infinite list of new unique identifiers

Instances
MonadUnique UniqSM Source # 
Instance details

Defined in UniqSupply

MonadUnique LlvmM Source # 
Instance details

Defined in LlvmCodeGen.Base

MonadUnique FCode Source # 
Instance details

Defined in StgCmmMonad

MonadUnique CmmParse Source # 
Instance details

Defined in StgCmmExtCode

MonadUnique CoreM Source # 
Instance details

Defined in CoreMonad

MonadUnique SimplM Source # 
Instance details

Defined in SimplMonad

MonadUnique TcS Source # 
Instance details

Defined in TcSMonad

MonadUnique NatM Source # 
Instance details

Defined in NCGMonad

MonadUnique (IOEnv (Env gbl lcl)) Source # 
Instance details

Defined in TcRnMonad

liftUs :: MonadUnique m => UniqSM a -> m a Source #

Operations on the monad

initUs :: UniqSupply -> UniqSM a -> (a, UniqSupply) Source #

Run the UniqSM action, returning the final UniqSupply

initUs_ :: UniqSupply -> UniqSM a -> a Source #

Run the UniqSM action, discarding the final UniqSupply

lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b Source #

lazyMapUs :: (a -> UniqSM b) -> [a] -> UniqSM [b] Source #

Set supply strategy