Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Striot.LogicalOptimiser
Synopsis
- applyRules :: [LabelledRewriteRule] -> Int -> Variant -> [Variant]
- rewriteGraph :: [LabelledRewriteRule] -> StreamGraph -> [Variant]
- data Variant
- variantSequence :: Variant -> [String]
- data LabelledRewriteRule = LabelledRewriteRule {
- ruleLabel :: String
- rule :: RewriteRule
- pureRules :: [LabelledRewriteRule]
- reorderingRules :: [LabelledRewriteRule]
- reshapingRules :: [LabelledRewriteRule]
- mergeFuse :: RewriteRule
Documentation
applyRules :: [LabelledRewriteRule] -> Int -> Variant -> [Variant] Source #
Apply a list of LabelledRewriteRule
s 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 StreamGraph
s: 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.
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
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
.
Constructors
LabelledRewriteRule | |
Fields
|
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.