Copyright | disco team and contributors |
---|---|
License | BSD-3-Clause |
Maintainer | byorgey@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Polysemy effect for fresh name generation, compatible with the unbound-generics library.
Synopsis
- data Fresh m a where
- fresh :: forall r x. Member Fresh r => Name x -> Sem r (Name x)
- runFresh' :: Integer -> Sem (Fresh ': r) a -> Sem r a
- runFresh :: Sem (Fresh ': r) a -> Sem r a
- runFresh1 :: Sem (Fresh ': r) a -> Sem r a
- unbind :: (Member Fresh r, Alpha p, Alpha t) => Bind p t -> Sem r (p, t)
- freshQ :: Member Fresh r => String -> Sem r (QName a)
- absorbFresh :: Member Fresh r => (Fresh (Sem r) => Sem r a) -> Sem r a
- newtype FreshDict m = FreshDict {}
- newtype Action m s' a = Action (m a)
Documentation
Fresh name generation effect, supporting raw generation of fresh
names, and opening binders with automatic freshening. Simply
increments a global counter every time fresh
is called and
makes a variable with that numeric suffix.
runFresh' :: Integer -> Sem (Fresh ': r) a -> Sem r a Source #
Dispatch the fresh name generation effect, starting at a given integer.
runFresh :: Sem (Fresh ': r) a -> Sem r a Source #
Run a computation requiring fresh name generation, beginning with 0 for the initial freshly generated name.
runFresh1 :: Sem (Fresh ': r) a -> Sem r a Source #
Run a computation requiring fresh name generation, beginning with 1 instead of 0 for the initial freshly generated name.
unbind :: (Member Fresh r, Alpha p, Alpha t) => Bind p t -> Sem r (p, t) Source #
Open a binder, automatically creating fresh names for the bound variables.
freshQ :: Member Fresh r => String -> Sem r (QName a) Source #
Generate a fresh (local, free) qualified name based on a given string.
newtype Action m s' a Source #
Wrapper for a monadic action with phantom type parameter for reflection. Locally defined so that the instance we are going to build with reflection must be coherent, that is there cannot be orphans.
Action (m a) |