Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data UniqSupply
- uniqFromSupply :: UniqSupply -> Unique
- uniqsFromSupply :: UniqSupply -> [Unique]
- takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply)
- mkSplitUniqSupply :: Char -> IO UniqSupply
- splitUniqSupply :: UniqSupply -> (UniqSupply, UniqSupply)
- listSplitUniqSupply :: UniqSupply -> [UniqSupply]
- splitUniqSupply3 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply)
- splitUniqSupply4 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply, UniqSupply)
- data UniqSM result
- class Monad m => MonadUnique m where
- getUniqueSupplyM :: m UniqSupply
- getUniqueM :: m Unique
- getUniquesM :: m [Unique]
- liftUs :: MonadUnique m => UniqSM a -> m a
- initUs :: UniqSupply -> UniqSM a -> (a, UniqSupply)
- initUs_ :: UniqSupply -> UniqSM a -> a
- lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b
- lazyMapUs :: (a -> UniqSM b) -> [a] -> UniqSM [b]
- getUniqueSupplyM3 :: MonadUnique m => m (UniqSupply, UniqSupply, UniqSupply)
- initUniqSupply :: Int -> Int -> IO ()
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
A monad which just gives the ability to obtain Unique
s
class Monad m => MonadUnique m where Source #
A monad for generating unique identifiers
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 # | |
Defined in UniqSupply | |
MonadUnique CoreM Source # | |
Defined in CoreMonad | |
MonadUnique LlvmM Source # | |
Defined in LlvmCodeGen.Base | |
MonadUnique FCode Source # | |
Defined in StgCmmMonad | |
MonadUnique CmmParse Source # | |
Defined in StgCmmExtCode | |
MonadUnique SimplM Source # | |
Defined in SimplMonad | |
MonadUnique TcS Source # | |
Defined in TcSMonad getUniqueSupplyM :: TcS UniqSupply Source # getUniqueM :: TcS Unique Source # getUniquesM :: TcS [Unique] Source # | |
MonadUnique NatM Source # | |
Defined in NCGMonad getUniqueSupplyM :: NatM UniqSupply Source # getUniqueM :: NatM Unique Source # getUniquesM :: NatM [Unique] Source # | |
MonadUnique (IOEnv (Env gbl lcl)) Source # | |
Defined in TcRnMonad getUniqueSupplyM :: IOEnv (Env gbl lcl) UniqSupply Source # |
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
getUniqueSupplyM3 :: MonadUnique m => m (UniqSupply, UniqSupply, UniqSupply) Source #