flocc-pffb

Stabilityexperimental
Maintainerdeveloper@flocc.net
Safe HaskellNone

Compiler.Planner.Rules

Description

For more information please see http://www.flocc.net/

Synopsis

Documentation

type ExpId = Idx

type RuleId = String

data Ruleset

Constructors

Ruleset 

Instances

loadRules :: [(String, Idx)] -> String -> IO Ruleset

loadRules varIds fileName. Loads ruleset from a file.

appRule :: Monad m => IdxTree -> Expr -> Expr -> IdxMonad m Expr

ruleit ruleExp exp. Instantiates rule applying it to argExp, by binding args in |a let, and then doing the rule exp (fun app).

appRulesM :: Monad m => () -> Expr -> StateT (Ruleset, SolId) (IdxMonad m) Expr

applyRules :: Monad m => Ruleset -> SolId -> Expr -> IdxMonad m Expr

applyRules rules solId ast. Applies the rules identified by the |solution id, to ast.

accumRuleApps :: Monad m => Ruleset -> Expr -> StateT [(ExpId, RuleId, [Int])] m Expr

getRuleApps :: Ruleset -> Expr -> [(ExpId, RuleId, [Int])]

getRuleApps rules ast. Returns a list of all the fun apps in ast |for which rules exist.

getRuleNames :: Ruleset -> Expr -> [(ExpId, RuleId, [Int])] -> [Int] -> [String]

Returns strings for the rules in sid

getAllRuleNames :: Ruleset -> Expr -> [(ExpId, RuleId, [Int])] -> [Int] -> [([Int], [String])]

Returns rule names for all combinations of rule applications