Portability | unportable (GHC 7 only) |
---|---|
Stability | experimental |
Maintainer | Brent Yorgey <byorgey@cis.upenn.edu> |
Safe Haskell | None |
- class Monad m => Fresh m where
- type FreshM = FreshMT Identity
- runFreshM :: FreshM a -> a
- contFreshM :: FreshM a -> Integer -> a
- newtype FreshMT m a = FreshMT {}
- runFreshMT :: Monad m => FreshMT m a -> m a
- contFreshMT :: Monad m => FreshMT m a -> Integer -> m a
- class Monad m => LFresh m where
- type LFreshM = LFreshMT Identity
- runLFreshM :: LFreshM a -> a
- contLFreshM :: LFreshM a -> Set AnyName -> a
- newtype LFreshMT m a = LFreshMT {
- unLFreshMT :: ReaderT (Set AnyName) m a
- runLFreshMT :: LFreshMT m a -> m a
- contLFreshMT :: LFreshMT m a -> Set AnyName -> m a
The Fresh
class
class Monad m => Fresh m whereSource
The Fresh
type class governs monads which can generate new
globally unique Name
s based on a given Name
.
Fresh m => Fresh (ListT m) | |
Fresh m => Fresh (MaybeT m) | |
Fresh m => Fresh (IdentityT m) | |
Monad m => Fresh (FreshMT m) | |
Fresh m => Fresh (ContT r m) | |
(Error e, Fresh m) => Fresh (ErrorT e m) | |
Fresh m => Fresh (ReaderT r m) | |
Fresh m => Fresh (StateT s m) | |
Fresh m => Fresh (StateT s m) | |
(Monoid w, Fresh m) => Fresh (WriterT w m) | |
(Monoid w, Fresh m) => Fresh (WriterT w m) |
contFreshM :: FreshM a -> Integer -> aSource
Run a FreshM computation given a starting index.
The FreshM
monad transformer. Keeps track of the lowest index
still globally unused, and increments the index every time it is
asked for a fresh name.
MonadTrans FreshMT | |
MonadError e m => MonadError e (FreshMT m) | |
MonadReader r m => MonadReader r (FreshMT m) | |
MonadState s m => MonadState s (FreshMT m) | |
MonadWriter w m => MonadWriter w (FreshMT m) | |
Monad m => Monad (FreshMT m) | |
Functor m => Functor (FreshMT m) | |
MonadFix m => MonadFix (FreshMT m) | |
MonadPlus m => MonadPlus (FreshMT m) | |
(Monad m, Functor m) => Applicative (FreshMT m) | |
MonadIO m => MonadIO (FreshMT m) | |
MonadCont m => MonadCont (FreshMT m) | |
Monad m => Fresh (FreshMT m) |
runFreshMT :: Monad m => FreshMT m a -> m aSource
Run a FreshMT
computation (with the global index starting at zero).
contFreshMT :: Monad m => FreshMT m a -> Integer -> m aSource
Run a FreshMT
computation given a starting index for fresh name
generation.
The LFresh
class
class Monad m => LFresh m whereSource
This is the class of monads that support freshness in an (implicit) local scope. Generated names are fresh for the current local scope, not necessarily globally fresh.
lfresh :: Rep a => Name a -> m (Name a)Source
Pick a new name that is fresh for the current (implicit) scope.
avoid :: [AnyName] -> m a -> m aSource
Avoid the given names when freshening in the subcomputation, that is, add the given names to the in-scope set.
getAvoids :: m (Set AnyName)Source
Get the set of names currently being avoided.
LFresh m => LFresh (ListT m) | |
LFresh m => LFresh (MaybeT m) | |
LFresh m => LFresh (IdentityT m) | |
Monad m => LFresh (LFreshMT m) | |
LFresh m => LFresh (ContT r m) | |
(Error e, LFresh m) => LFresh (ErrorT e m) | |
LFresh m => LFresh (ReaderT r m) | |
LFresh m => LFresh (StateT s m) | |
LFresh m => LFresh (StateT s m) | |
(Monoid w, LFresh m) => LFresh (WriterT w m) | |
(Monoid w, LFresh m) => LFresh (WriterT w m) |
type LFreshM = LFreshMT IdentitySource
A convenient monad which is an instance of LFresh
. It keeps
track of a set of names to avoid, and when asked for a fresh one
will choose the first unused numerical name.
runLFreshM :: LFreshM a -> aSource
Run a LFreshM computation in an empty context.
contLFreshM :: LFreshM a -> Set AnyName -> aSource
Run a LFreshM computation given a set of names to avoid.
The LFresh monad transformer. Keeps track of a set of names to avoid, and when asked for a fresh one will choose the first numeric prefix of the given name which is currently unused.
LFreshMT | |
|
MonadTrans LFreshMT | |
MonadError e m => MonadError e (LFreshMT m) | |
MonadReader r m => MonadReader r (LFreshMT m) | |
MonadState s m => MonadState s (LFreshMT m) | |
MonadWriter w m => MonadWriter w (LFreshMT m) | |
Monad m => Monad (LFreshMT m) | |
Functor m => Functor (LFreshMT m) | |
MonadFix m => MonadFix (LFreshMT m) | |
MonadPlus m => MonadPlus (LFreshMT m) | |
Applicative m => Applicative (LFreshMT m) | |
MonadIO m => MonadIO (LFreshMT m) | |
MonadCont m => MonadCont (LFreshMT m) | |
Monad m => LFresh (LFreshMT m) |
runLFreshMT :: LFreshMT m a -> m aSource
Run an LFreshMT
computation in an empty context.