never executed always true always false
1 module Conjure.Rules.Vertical.Partition.PartitionAsSet where
2
3 import Conjure.Rules.Import
4
5
6 rule_Comprehension :: Rule
7 rule_Comprehension = "partition-comprehension{PartitionAsSet}" `namedRule` theRule where
8 theRule (Comprehension body gensOrConds) = do
9 (gocBefore, (pat, expr), gocAfter) <- matchFirst gensOrConds $ \ goc -> case goc of
10 Generator (GenInExpr pat@Single{} expr) -> return (pat, matchDefs [opToSet, opToMSet] expr)
11 _ -> na "rule_Comprehension"
12 let partition_ = matchDef opParts expr
13 TypePartition{} <- typeOf partition_
14 Partition_AsSet{} <- representationOf partition_
15 [s] <- downX1 partition_
16 let upd val old = lambdaToFunction pat old val
17 return
18 ( "Vertical rule for partition-comprehension, PartitionAsSet representation"
19 , do
20 (jPat, j) <- quantifiedVar
21 let val = j
22 return $ Comprehension (upd val body)
23 $ gocBefore
24 ++ [ Generator (GenInExpr jPat s) ]
25 ++ transformBi (upd val) gocAfter
26 )
27 theRule _ = na "rule_Comprehension"