Portability | ghc |
---|---|
Stability | beta |
Maintainer | Neil Sculthorpe <neil@ittc.ku.edu> |
Safe Haskell | Safe-Inferred |
This module defines Translate
and Rewrite
, the main KURE types.
Rewrite
is just a special case of Translate
, and so any function that operates on Translate
is also
applicable to Rewrite
.
Translate
is an instance of the Monad
and Arrow
type-class families, and consequently
many of the desirable combinators over Translate
and Rewrite
are special cases
of existing monadic or arrow combinators.
Language.KURE.Combinators provides some additional combinators that aren't in the standard libraries.
- data Translate c m a b
- type Rewrite c m a = Translate c m a a
- apply :: Translate c m a b -> c -> a -> m b
- translate :: (c -> a -> m b) -> Translate c m a b
- rewrite :: (c -> a -> m a) -> Rewrite c m a
- contextfreeT :: (a -> m b) -> Translate c m a b
- contextonlyT :: (c -> m b) -> Translate c m a b
- constT :: m b -> Translate c m a b
Translations and Rewrites
An abstract representation of a transformation from a value of type a
in a context c
to a monadic value of type m b
.
The Translate
type is the basis of the entire KURE library.
Monad m => Arrow (Translate c m) | The |
MonadPlus m => ArrowZero (Translate c m) | The |
MonadPlus m => ArrowPlus (Translate c m) | The |
Monad m => ArrowApply (Translate c m) | The |
Monad m => Category (Translate c m) | The |
Monad m => Monad (Translate c m a) | Lifting through a Reader transformer, where (c,a) is the read-only environment. |
Functor m => Functor (Translate c m a) | Lifting through a Reader transformer, where (c,a) is the read-only environment. |
MonadPlus m => MonadPlus (Translate c m a) | Lifting through a Reader transformer, where (c,a) is the read-only environment. |
Applicative m => Applicative (Translate c m a) | Lifting through a Reader transformer, where (c,a) is the read-only environment. |
Alternative m => Alternative (Translate c m a) | Lifting through a Reader transformer, where (c,a) is the read-only environment. |
MonadCatch m => MonadCatch (Translate c m a) | Lifting through a Reader transformer, where (c,a) is the read-only environment. |
(Monad m, Monoid b) => Monoid (Translate c m a b) | Lifting through the |
type Rewrite c m a = Translate c m a aSource
A Translate
that shares the same source and target type.
contextfreeT :: (a -> m b) -> Translate c m a bSource
Build a Translate
that doesn't depend on the context.
contextonlyT :: (c -> m b) -> Translate c m a bSource
Build a Translate
that doesn't depend on the value.