|
|
|
|
|
|
Synopsis |
|
|
|
|
Main data type
|
|
data UniqSupply |
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 |
Obtain the Unique from this particular UniqSupply
|
|
uniqsFromSupply :: UniqSupply -> [Unique] |
Obtain an infinite list of Unique that can be generated by constant splitting of the supply
|
|
mkSplitUniqSupply :: Char -> IO UniqSupply |
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) |
Build two UniqSupply from a single one, each of which
can supply its own Unique.
|
|
listSplitUniqSupply :: UniqSupply -> [UniqSupply] |
Create an infinite list of UniqSupply from a single one
|
|
Unique supply monad and its abstraction
|
|
data UniqSM result |
A monad which just gives the ability to obtain Uniques
| Instances | |
|
|
class Monad m => MonadUnique m where |
A monad for generating unique identifiers
| | Methods | getUniqueSupplyM :: m UniqSupply | Get a new UniqueSupply
| | getUniqueM :: m Unique | Get a new unique identifier
| | getUniquesM :: m [Unique] | Get an infinite list of new unique identifiers
|
| | Instances | |
|
|
Operations on the monad
|
|
initUs :: UniqSupply -> UniqSM a -> (a, UniqSupply) |
Run the UniqSM action, returning the final UniqSupply
|
|
initUs_ :: UniqSupply -> UniqSM a -> a |
Run the UniqSM action, discarding the final UniqSupply
|
|
lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b |
|
lazyMapUs :: (a -> UniqSM b) -> [a] -> UniqSM [b] |
|
Deprecated operations on UniqSM
|
|
getUniqueUs :: UniqSM Unique |
|
getUs :: UniqSM UniqSupply |
|
returnUs :: a -> UniqSM a |
|
thenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b |
|
mapUs :: (a -> UniqSM b) -> [a] -> UniqSM [b] |
|
Produced by Haddock version 2.4.2 |