Portability | ghc |
---|---|

Stability | beta |

Maintainer | Neil Sculthorpe <neil@ittc.ku.edu> |

Safe Haskell | Safe-Inferred |

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

- data BiTransform c m a b
- type BiTranslate c m a b = BiTransform c m a b
- type BiRewrite c m a = BiTransform c m a a
- bidirectional :: Transform c m a b -> Transform c m b a -> BiTransform c m a b
- forwardT :: BiTransform c m a b -> Transform c m a b
- backwardT :: BiTransform c m a b -> Transform c m b a
- whicheverR :: MonadCatch m => BiRewrite c m a -> Rewrite c m a
- invertBiT :: BiTransform c m a b -> BiTransform c m b a
- beforeBiR :: Monad m => Transform c m a b -> (b -> BiRewrite c m a) -> BiRewrite c m a

# Bi-directional Transformations

type BiTranslate c m a b = BiTransform c m a bSource

A deprecated synonym for `BiTranslate`

.

type BiRewrite c m a = BiTransform c m a aSource

A `BiTransform`

that shares the same source and target type.

bidirectional :: Transform c m a b -> Transform c m b a -> BiTransform c m a bSource

Construct a `BiTransform`

from two opposite `Transform`

s.

forwardT :: BiTransform c m a b -> Transform c m a bSource

Extract the forward `Transform`

from a `BiTransform`

.

backwardT :: BiTransform c m a b -> Transform c m b aSource

Extract the backward `Transform`

from a `BiTransform`

.

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 :: BiTransform c m a b -> BiTransform c m b aSource

Invert the forwards and backwards directions of a `BiTransform`

.