kure-2.12.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.

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

Extract the foreward 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 forewards, 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 forewards 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.