kure-2.14.0: Combinators for Strategic Programming

MaintainerNeil Sculthorpe <neil@ittc.ku.edu>
Safe HaskellSafe-Inferred




A bi-directional translation is a translation that can be applied in either direction.


Bi-directional Translations

data BiTranslate c m a b Source

An undirected Translate.


type BiRewrite c m a = BiTranslate c m a aSource

A BiTranslate that shares the same source and target type.

bidirectional :: Translate c m a b -> Translate c m b a -> BiTranslate c m a bSource

Construct a BiTranslate from two opposite Translates.

forwardT :: BiTranslate c m a b -> Translate c m a bSource

Extract the forward Translate from a BiTranslate.

backwardT :: BiTranslate c m a b -> Translate c m b aSource

Extract the backward Translate from a BiTranslate.

whicheverR :: MonadCatch m => BiRewrite c m a -> Rewrite c m aSource

Try the BiRewrite forwards, then backwards if that fails. Useful when you know which rule you want to apply, but not which direction to apply it in.

invertBiT :: BiTranslate c m a b -> BiTranslate c m b aSource

Invert the forwards and backwards directions of a BiTranslate.

beforeBiR :: Monad m => Translate c m a b -> (b -> BiRewrite c m a) -> BiRewrite c m aSource

Perform the argument translation before either direction of the bidirectional rewrite.