Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data DUniqSupply
- data UniqDSM result where
- pattern UDSM :: (DUniqSupply -> DUniqResult a) -> UniqDSM a
- type DUniqResult result = (# result, DUniqSupply #)
- pattern DUniqResult :: a -> DUniqSupply -> (# a, DUniqSupply #)
- getUniqueDSM :: UniqDSM Unique
- runUniqueDSM :: DUniqSupply -> UniqDSM a -> (a, DUniqSupply)
- takeUniqueFromDSupply :: DUniqSupply -> (Unique, DUniqSupply)
- initDUniqSupply :: Char -> Word64 -> DUniqSupply
- newTagDUniqSupply :: Char -> DUniqSupply -> DUniqSupply
- getTagDUniqSupply :: DUniqSupply -> Char
- data UniqDSMT (m :: Type -> Type) result where
- pattern UDSMT :: (DUniqSupply -> m (result, DUniqSupply)) -> UniqDSMT m result
- runUDSMT :: DUniqSupply -> UniqDSMT m a -> m (a, DUniqSupply)
- withDUS :: (DUniqSupply -> IO (a, DUniqSupply)) -> UniqDSMT IO a
- hoistUDSMT :: (forall x. m x -> n x) -> UniqDSMT m a -> UniqDSMT n a
- liftUDSMT :: Functor m => m a -> UniqDSMT m a
- setTagUDSMT :: forall (m :: Type -> Type) a. Monad m => Char -> UniqDSMT m a -> UniqDSMT m a
- class Monad m => MonadGetUnique (m :: Type -> Type) where
- getUniqueM :: m Unique
- class Monad m => MonadUniqDSM (m :: Type -> Type) where
- liftUniqDSM :: UniqDSM a -> m a
Threading a deterministic supply
data DUniqSupply Source #
data UniqDSM result where Source #
A monad which just gives the ability to obtain Unique
s deterministically.
There's no splitting.
pattern UDSM :: (DUniqSupply -> DUniqResult a) -> UniqDSM a |
Instances
MonadGetUnique UniqDSM Source # | |
Defined in GHC.Types.Unique.DSM | |
MonadUniqDSM UniqDSM Source # | |
Defined in GHC.Types.Unique.DSM liftUniqDSM :: UniqDSM a -> UniqDSM a Source # | |
Applicative UniqDSM Source # | |
Functor UniqDSM Source # | |
Monad UniqDSM Source # | |
MonadFix UniqDSM Source # | |
Defined in GHC.Types.Unique.DSM |
type DUniqResult result = (# result, DUniqSupply #) Source #
pattern DUniqResult :: a -> DUniqSupply -> (# a, DUniqSupply #) Source #
UniqDSM and DUniqSupply operations
runUniqueDSM :: DUniqSupply -> UniqDSM a -> (a, DUniqSupply) Source #
takeUniqueFromDSupply :: DUniqSupply -> (Unique, DUniqSupply) Source #
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.
pattern UDSMT :: (DUniqSupply -> m (result, DUniqSupply)) -> UniqDSMT m result |
Instances
Monad m => MonadGetUnique (UniqDSMT m) Source # | |
Defined in GHC.Types.Unique.DSM getUniqueM :: UniqDSMT m Unique Source # | |
Monad m => MonadUniqDSM (UniqDSMT m) Source # | |
Defined in GHC.Types.Unique.DSM liftUniqDSM :: UniqDSM a -> UniqDSMT m a Source # | |
Monad m => Applicative (UniqDSMT m) Source # | |
Defined in GHC.Types.Unique.DSM | |
Functor m => Functor (UniqDSMT m) Source # | |
Monad m => Monad (UniqDSMT m) Source # | |
MonadIO m => MonadIO (UniqDSMT m) Source # | |
Defined in GHC.Types.Unique.DSM |
UniqDSMT operations
runUDSMT :: DUniqSupply -> UniqDSMT m a -> m (a, DUniqSupply) Source #
Like runUniqueDSM
but for UniqDSMT
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
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.
getUniqueM :: m Unique Source #
Instances
MonadGetUnique Opt Source # | |
Defined in GHC.Cmm.Opt getUniqueM :: Opt Unique Source # | |
MonadGetUnique NatM Source # | |
Defined in GHC.CmmToAsm.Monad getUniqueM :: NatM Unique Source # | |
MonadGetUnique LlvmM Source # | |
Defined in GHC.CmmToLlvm.Base getUniqueM :: LlvmM Unique Source # | |
MonadGetUnique NullCollapseViz Source # | |
Defined in GHC.Data.Graph.Collapse | |
MonadGetUnique CmmParse Source # | |
Defined in GHC.StgToCmm.ExtCode | |
MonadGetUnique FCode Source # | |
Defined in GHC.StgToCmm.Monad getUniqueM :: FCode Unique Source # | |
MonadGetUnique UniqDSM Source # | |
Defined in GHC.Types.Unique.DSM | |
MonadGetUnique UniqSM Source # | |
Defined in GHC.Types.Unique.DSM | |
MonadGetUnique (WasmCodeGenM w) Source # | |
Defined in GHC.CmmToAsm.Wasm.Types getUniqueM :: WasmCodeGenM w Unique Source # | |
Monad m => MonadGetUnique (UniqDSMT m) Source # | |
Defined in GHC.Types.Unique.DSM getUniqueM :: UniqDSMT m Unique Source # |
class Monad m => MonadUniqDSM (m :: Type -> Type) where Source #
liftUniqDSM :: UniqDSM a -> m a Source #
Lift a pure UniqDSM
action into a MonadUniqDSM
such as UniqDSMT
Instances
MonadUniqDSM NullCollapseViz Source # | |
Defined in GHC.Data.Graph.Collapse liftUniqDSM :: UniqDSM a -> NullCollapseViz a Source # | |
MonadUniqDSM UniqDSM Source # | |
Defined in GHC.Types.Unique.DSM liftUniqDSM :: UniqDSM a -> UniqDSM a Source # | |
MonadUniqDSM (WasmCodeGenM w) Source # | |
Defined in GHC.CmmToAsm.Wasm.Types liftUniqDSM :: UniqDSM a -> WasmCodeGenM w a Source # | |
Monad m => MonadUniqDSM (UniqDSMT m) Source # | |
Defined in GHC.Types.Unique.DSM liftUniqDSM :: UniqDSM a -> UniqDSMT m a Source # |