| Safe Haskell | Ignore |
|---|---|
| Language | GHC2021 |
GHC.Types.Unique.DSM
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 #
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
| Applicative UniqDSM # | |
| Functor UniqDSM # | |
| Monad UniqDSM # | |
| MonadFix UniqDSM # | |
Defined in GHC.Types.Unique.DSM | |
| MonadGetUnique UniqDSM # | |
Defined in GHC.Types.Unique.DSM Methods getUniqueM :: UniqDSM Unique # | |
| MonadUniqDSM UniqDSM # | |
Defined in GHC.Types.Unique.DSM Methods liftUniqDSM :: UniqDSM a -> UniqDSM a # | |
type DUniqResult result = (# result, DUniqSupply #) #
pattern DUniqResult :: a -> DUniqSupply -> (# a, DUniqSupply #) #
UniqDSM and DUniqSupply operations
runUniqueDSM :: DUniqSupply -> UniqDSM a -> (a, DUniqSupply) #
takeUniqueFromDSupply :: DUniqSupply -> (Unique, DUniqSupply) #
initDUniqSupply :: Char -> Word64 -> DUniqSupply #
Initialize a deterministic unique supply with the given Tag and initial unique.
Tag operations
newTagDUniqSupply :: Char -> DUniqSupply -> DUniqSupply #
Set the tag of uniques generated from this deterministic unique supply
getTagDUniqSupply :: DUniqSupply -> Char #
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 #
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
| MonadIO m => MonadIO (UniqDSMT m) # | |
Defined in GHC.Types.Unique.DSM | |
| Monad m => Applicative (UniqDSMT m) # | |
Defined in GHC.Types.Unique.DSM | |
| Functor m => Functor (UniqDSMT m) # | |
| Monad m => Monad (UniqDSMT m) # | |
| Monad m => MonadGetUnique (UniqDSMT m) # | |
Defined in GHC.Types.Unique.DSM Methods getUniqueM :: UniqDSMT m Unique # | |
| Monad m => MonadUniqDSM (UniqDSMT m) # | |
Defined in GHC.Types.Unique.DSM Methods liftUniqDSM :: UniqDSM a -> UniqDSMT m a # | |
UniqDSMT operations
runUDSMT :: DUniqSupply -> UniqDSMT m a -> m (a, DUniqSupply) #
Like runUniqueDSM but for UniqDSMT
withDUS :: (DUniqSupply -> IO (a, DUniqSupply)) -> UniqDSMT IO a #
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 #
Change the monad underyling an applied UniqDSMT, i.e. transform a
UniqDSMT m into a UniqDSMT n given m ~> n.
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 #
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.
Methods
getUniqueM :: m Unique #
Instances
| MonadGetUnique UniqDSM # | |
Defined in GHC.Types.Unique.DSM Methods getUniqueM :: UniqDSM Unique # | |
| MonadGetUnique UniqSM # | |
Defined in GHC.Types.Unique.DSM Methods getUniqueM :: UniqSM Unique # | |
| Monad m => MonadGetUnique (UniqDSMT m) # | |
Defined in GHC.Types.Unique.DSM Methods getUniqueM :: UniqDSMT m Unique # | |
class Monad m => MonadUniqDSM (m :: Type -> Type) where #
Methods
liftUniqDSM :: UniqDSM a -> m a #
Lift a pure UniqDSM action into a MonadUniqDSM such as UniqDSMT
Instances
| MonadUniqDSM UniqDSM # | |
Defined in GHC.Types.Unique.DSM Methods liftUniqDSM :: UniqDSM a -> UniqDSM a # | |
| Monad m => MonadUniqDSM (UniqDSMT m) # | |
Defined in GHC.Types.Unique.DSM Methods liftUniqDSM :: UniqDSM a -> UniqDSMT m a # | |