kure-0.3.1: Combinators for Strategic Programming

MaintainerAndy Gill <andygill@ku.edu>



Translate is the main abstraction inside KURE, and represents a rewriting from a source to a target of a possibly different type.

Rewrite (defined in Language.KURE.Rewrite) is a synonoym for a Translate with the same source and target type.



data Translate m dec exp1 exp2 Source

Translate is a translation or strategy that translates between exp1 and exp2, with the posiblity of failure, and remembers identity translations.


(Monad m, Monoid dec) => Failable (Translate m dec a) 

apply :: (Monoid dec, Monad m) => Translate m dec exp1 exp2 -> exp1 -> RewriteM m dec exp2Source

apply directly applies a Translate value to an argument.

runTranslate :: (Monoid dec, Monad m) => Translate m dec exp res -> dec -> exp -> m (Either String (res, dec, Int))Source

runTranslate executes the translation, returning either a failure message, or a success and the new parts of the environment.

transparently :: (Monoid dec, Monad m) => Translate m dec exp1 exp2 -> Translate m dec exp1 exp2Source

transparently marks a translate (or rewrite) as transparent, that is the identity status of any internal applications of apply is preserved across the translate.

Note: transparently $ translate $ \ e -> return e is an identity rewrite.

translate :: (Monoid dec, Monad m) => (exp1 -> RewriteM m dec exp2) -> Translate m dec exp1 exp2Source

translate is the standard way of building a Translate, where if the translation is successful it is automatically marked as a non-identity translation.

Note: translate $ \ e -> return e is not an identity rewrite, but a succesful rewrite that returns its provided argument.