kure-2.6.14: Combinators for Strategic Programming

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

Language.KURE.BiTranslate

Contents

Description

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

Synopsis

Bi-directional Translations

data BiTranslate c m a b Source

An undirected Translate.

Instances

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.

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

Invert the forewards and backwards directions of a BiTranslate.