kure-2.16.6: Combinators for Strategic Programming

Copyright(c) 2012--2014 The University of Kansas
LicenseBSD3
MaintainerNeil Sculthorpe <neil@ittc.ku.edu>
Stabilitybeta
Portabilityghc
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.KURE.BiTransform

Contents

Description

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

Synopsis

Bi-directional Transformations

data BiTransform c m a b Source

An undirected Transform.

Instances

Monad m => Category * (BiTransform c m) 

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

A deprecated synonym for BiTranslate.

type BiRewrite c m a = BiTransform c m a a Source

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 b Source

Construct a BiTransform from two opposite Transforms.

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

Extract the forward Transform from a BiTransform.

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

Extract the backward Transform from a BiTransform.

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

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 a Source

Invert the forwards and backwards directions of a BiTransform.

beforeBiR :: Monad m => Transform c m a b -> (b -> BiRewrite c m a) -> BiRewrite c m a Source

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

afterBiR :: Monad m => BiRewrite c m a -> Rewrite c m a -> BiRewrite c m a Source

Apply the argument rewrite to the result of either direction of the bidirectional rewrite.