ghc-9.13: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Types.Unique.DSM

Synopsis

Threading a deterministic supply

data UniqDSM result where Source #

A monad which just gives the ability to obtain Uniques deterministically. There's no splitting.

Bundled Patterns

pattern UDSM :: (DUniqSupply -> DUniqResult a) -> UniqDSM a 

Instances

Instances details
MonadGetUnique UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

MonadUniqDSM UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Applicative UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

pure :: a -> UniqDSM a #

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

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

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

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

Functor UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

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

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

Monad UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

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

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

return :: a -> UniqDSM a #

MonadFix UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

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

type DUniqResult result = (# result, DUniqSupply #) Source #

pattern DUniqResult :: a -> DUniqSupply -> (# a, DUniqSupply #) Source #

UniqDSM and DUniqSupply operations

initDUniqSupply :: Char -> Word64 -> DUniqSupply Source #

Initialize a deterministic unique supply with the given Tag and initial unique.

Tag operations

newTagDUniqSupply :: Char -> DUniqSupply -> DUniqSupply Source #

Set the tag of uniques generated from this deterministic unique supply

getTagDUniqSupply :: DUniqSupply -> Char Source #

Get the tag uniques generated from this deterministic unique supply would have

A transfomer threading a deterministic supply

data UniqDSMT (m :: Type -> Type) result where Source #

Transformer version of UniqDSM to use when threading a deterministic uniq supply over a Monad. Specifically, it is used in the Stream of Cmm decls.

Bundled Patterns

pattern UDSMT :: (DUniqSupply -> m (result, DUniqSupply)) -> UniqDSMT m result 

Instances

Instances details
Monad m => MonadGetUnique (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Monad m => MonadUniqDSM (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

liftUniqDSM :: UniqDSM a -> UniqDSMT m a Source #

Monad m => Applicative (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

pure :: a -> UniqDSMT m a #

(<*>) :: UniqDSMT m (a -> b) -> UniqDSMT m a -> UniqDSMT m b #

liftA2 :: (a -> b -> c) -> UniqDSMT m a -> UniqDSMT m b -> UniqDSMT m c #

(*>) :: UniqDSMT m a -> UniqDSMT m b -> UniqDSMT m b #

(<*) :: UniqDSMT m a -> UniqDSMT m b -> UniqDSMT m a #

Functor m => Functor (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

fmap :: (a -> b) -> UniqDSMT m a -> UniqDSMT m b #

(<$) :: a -> UniqDSMT m b -> UniqDSMT m a #

Monad m => Monad (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

(>>=) :: UniqDSMT m a -> (a -> UniqDSMT m b) -> UniqDSMT m b #

(>>) :: UniqDSMT m a -> UniqDSMT m b -> UniqDSMT m b #

return :: a -> UniqDSMT m a #

MonadIO m => MonadIO (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

liftIO :: IO a -> UniqDSMT m a #

UniqDSMT operations

withDUS :: (DUniqSupply -> IO (a, DUniqSupply)) -> UniqDSMT IO a Source #

Lift an IO action that depends on, and threads through, a unique supply into UniqDSMT IO.

hoistUDSMT :: (forall x. m x -> n x) -> UniqDSMT m a -> UniqDSMT n a Source #

Change the monad underyling an applied UniqDSMT, i.e. transform a UniqDSMT m into a UniqDSMT n given m ~> n.

liftUDSMT :: Functor m => m a -> UniqDSMT m a Source #

Lift a monadic action m a into an UniqDSMT m a

Tags

setTagUDSMT Source #

Arguments

:: forall (m :: Type -> Type) a. Monad m 
=> Char

Tag

-> UniqDSMT m a 
-> UniqDSMT m a 

Set the tag of the running UniqDSMT supply to the given tag and run an action with it. All uniques produced in the given action will use this tag, until the tag is changed again.

Monad class for deterministic supply threading

class Monad m => MonadGetUnique (m :: Type -> Type) where Source #

Get a unique from a monad that can access a unique supply.

Crucially, because MonadGetUnique doesn't allow you to get the UniqSupply (unlike MonadUnique), an instance such as UniqDSM can use a deterministic unique supply to return deterministic uniques without allowing for the UniqSupply to be shared.

Instances

Instances details
MonadGetUnique Opt Source # 
Instance details

Defined in GHC.Cmm.Opt

MonadGetUnique NatM Source # 
Instance details

Defined in GHC.CmmToAsm.Monad

MonadGetUnique LlvmM Source # 
Instance details

Defined in GHC.CmmToLlvm.Base

MonadGetUnique NullCollapseViz Source # 
Instance details

Defined in GHC.Data.Graph.Collapse

MonadGetUnique CmmParse Source # 
Instance details

Defined in GHC.StgToCmm.ExtCode

MonadGetUnique FCode Source # 
Instance details

Defined in GHC.StgToCmm.Monad

MonadGetUnique UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

MonadGetUnique UniqSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

MonadGetUnique (WasmCodeGenM w) Source # 
Instance details

Defined in GHC.CmmToAsm.Wasm.Types

Monad m => MonadGetUnique (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

class Monad m => MonadUniqDSM (m :: Type -> Type) where Source #

Methods

liftUniqDSM :: UniqDSM a -> m a Source #

Lift a pure UniqDSM action into a MonadUniqDSM such as UniqDSMT

Instances

Instances details
MonadUniqDSM NullCollapseViz Source # 
Instance details

Defined in GHC.Data.Graph.Collapse

MonadUniqDSM UniqDSM Source # 
Instance details

Defined in GHC.Types.Unique.DSM

MonadUniqDSM (WasmCodeGenM w) Source # 
Instance details

Defined in GHC.CmmToAsm.Wasm.Types

Monad m => MonadUniqDSM (UniqDSMT m) Source # 
Instance details

Defined in GHC.Types.Unique.DSM

Methods

liftUniqDSM :: UniqDSM a -> UniqDSMT m a Source #