HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

  • Packageghc-9.14.1
  • Exports20
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceDSM.hs

Threading a deterministic supply

5 declarations
newtypenewtype UniqDSM result
#

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

Instances6Monad, Functor, MonadFix, Applicative, MonadGetUnique, MonadUniqDSM

UniqDSM and DUniqSupply operations

Tag operations

A transfomer threading a deterministic supply

2 declarations
newtypenewtype UniqDSMT (m :: Type -> Type) result
#

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.

Instances6Monad, Functor, Applicative, MonadIO, MonadGetUnique, MonadUniqDSM

UniqDSMT operations

valuehoistUDSMT :: (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

valuesetTagUDSMT
  1. :: Monad m
  2. => Char

    Tag

  3. -> UniqDSMT m a
  4. -> 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

2 declarations
classclass 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

Instances10MonadGetUnique, …