striot-0.2.1.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Striot.LogicalOptimiser

Synopsis

Documentation

applyRules :: [LabelledRewriteRule] -> Int -> Variant -> [Variant] Source #

Apply a list of LabelledRewriteRules to a Variant stream program to derive rewritten programs. Bound the depth of rule application by the supplied parameter. The resulting list may include many equivalent StreamGraphs: the caller may wish to use `nub . variantGraph` or `nubBy (on (==) variantGraph)` to de-duplicate.

rewriteGraph :: [LabelledRewriteRule] -> StreamGraph -> [Variant] Source #

Convenience function to call applyRules with an initial StreamGraph, encoding a sensible depth limit of 5.

data Variant Source #

A variant (variantGraph) of a stream-processing program (variantParent), produced by applying a rewrite rule (variantRule). The Original constructor is to represent the original, unmodified, input stream-processing program.

Instances

Instances details
Show Variant Source # 
Instance details

Defined in Striot.LogicalOptimiser

Eq Variant Source # 
Instance details

Defined in Striot.LogicalOptimiser

Methods

(==) :: Variant -> Variant -> Bool #

(/=) :: Variant -> Variant -> Bool #

variantSequence :: Variant -> [String] Source #

Extract a list of RewriteRule labels from a Variant, to see the sequence of rules that produced it.

RewriteRule

RewriteRule and LabelledRewriteRule are defined in a sub-module RewriteRule and re-exported here, due to technical restrictions with Template Haskell.

data LabelledRewriteRule Source #

A pairing of a RewriteRule with its name, encoded in a String.

pureRules :: [LabelledRewriteRule] Source #

Semantically-preserving rules. XXX pureRules is not a good name

reorderingRules :: [LabelledRewriteRule] Source #

A list of rules which cause Stream re-ordering. These are included in defaultRewriteRules.

reshapingRules :: [LabelledRewriteRule] Source #

A list of rules which cause re-shaping of Windows. These are not included in defaultRewriteRules.

mergeFuse :: RewriteRule Source #

fuse two Merge operators. The order-preserving transformation is strictly right-oriented i.e. merge [s1, merge [s2,s3]] == merge [s1,s2,s3] but for non-order-preserving we can write a much more generic rule.