Maintainer | bastiaan.heeren@ou.nl |
---|---|

Stability | provisional |

Portability | portable (depends on ghc) |

Safe Haskell | None |

Language | Haskell98 |

A rule is just a transformation with some meta-information, such as a name (which should be unique) and properties such as "buggy" or "minor". Rules can be lifted with a view using the LiftView type class.

## Synopsis

- data Rule a
- transformation :: Rule a -> Transformation a
- recognizer :: Recognizable f => f a -> Recognizer a
- checkReferences :: Rule a -> Environment -> Maybe String
- makeRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a
- ruleMaybe :: IsId n => n -> (a -> Maybe a) -> Rule a
- ruleList :: IsId n => n -> (a -> [a]) -> Rule a
- ruleTrans :: IsId n => n -> Transformation a -> Rule a
- ruleRewrite :: RewriteRule a -> Rule a
- buggyRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a
- minorRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a
- rewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> Rule a
- rewriteRules :: (IsId n, RuleBuilder f a) => n -> [f] -> Rule a
- idRule :: IsId n => n -> Rule a
- checkRule :: IsId n => n -> (a -> Bool) -> Rule a
- emptyRule :: IsId n => n -> Rule a
- ruleSiblings :: Rule a -> [Id]
- siblingOf :: HasId b => b -> Rule a -> Rule a
- isRewriteRule :: Rule a -> Bool
- doAfter :: (a -> a) -> Rule a -> Rule a
- addRecognizer :: Recognizer a -> Rule a -> Rule a
- addRecognizerBool :: (a -> a -> Bool) -> Rule a -> Rule a
- addTransRecognizer :: (a -> a -> Bool) -> Rule a -> Rule a

# Rule data type and accessors

Abstract data type for representing rules

## Instances

Apply Rule Source # | |

Defined in Ideas.Common.Rule.Abstract | |

LiftView Rule Source # | |

Recognizable Rule Source # | |

Defined in Ideas.Common.Rule.Abstract recognizer :: Rule a -> Recognizer a Source # recognizeAll :: Rule a -> a -> a -> [Environment] Source # recognize :: Rule a -> a -> a -> Maybe Environment Source # recognizeTrans :: Rule a -> Trans (a, a) () Source # | |

IsStrategy Rule Source # | |

Defined in Ideas.Common.Strategy.Abstract toStrategy :: Rule a -> Strategy a Source # | |

Eq (Rule a) Source # | |

Ord (Rule a) Source # | |

Show (Rule a) Source # | |

Minor (Rule a) Source # | |

Buggy (Rule a) Source # | |

HasId (Rule a) Source # | |

HasRefs (Rule a) Source # | |

LabelSymbol (Rule a) Source # | |

Defined in Ideas.Common.Strategy.Symbol isEnterSymbol :: Rule a -> Bool Source # | |

AtomicSymbol (Rule a) Source # | |

Defined in Ideas.Common.Strategy.Symbol atomicOpen :: Rule a Source # atomicClose :: Rule a Source # |

transformation :: Rule a -> Transformation a Source #

recognizer :: Recognizable f => f a -> Recognizer a Source #

checkReferences :: Rule a -> Environment -> Maybe String Source #

# Constructor functions

ruleRewrite :: RewriteRule a -> Rule a Source #

rewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> Rule a Source #

rewriteRules :: (IsId n, RuleBuilder f a) => n -> [f] -> Rule a Source #

# Special minor rules

checkRule :: IsId n => n -> (a -> Bool) -> Rule a Source #

A special (minor) rule that checks a predicate (and returns the identity if the predicate holds)

emptyRule :: IsId n => n -> Rule a Source #

A special (minor) rule that is never applicable (i.e., this rule always fails)

# Rule properties

ruleSiblings :: Rule a -> [Id] Source #

isRewriteRule :: Rule a -> Bool Source #

# Recognizer

addRecognizer :: Recognizer a -> Rule a -> Rule a Source #