+data CombineFun = ADD | DIFF | SUB
+ deriving (Eq,Show, Read, Enum)
+
+theCombineFun :: CombineFun -> Integer -> Integer -> Integer
+theCombineFun fn = case fn of
+ ADD -> \ l r -> l + r
+ SUB -> \ l r -> max 0 (l - r)
+ DIFF -> \ g b -> if g > 0 then 0 else min 1 b
+
+foldFuns :: [ (String,CombineFun) ]
+foldFuns = [ (show comb,comb)
+ | comb <- [ADD .. SUB]
+ ]
+
+data PostFun = ID | INV | ZERO
+ deriving (Eq,Show, Read, Enum)
+
+thePostFun :: PostFun -> Integer -> Integer
+thePostFun ID x = x
+thePostFun INV 0 = 1
+thePostFun INV _ = 0
+thePostFun ZERO _ = 0
+
+postFuns :: [(String, PostFun)]
+postFuns = [ (show pos,pos)
+ | pos <- [ID .. ZERO]
+ ]
+
+
+data MergeFun = INTERSECTION | UNION