useRule :: Rule -> Interval -> ([Interval], [Interval], [Rule])
useRule (Rule (Iv rl rh) d) (Iv xl xh) = (newResults, newVals, newRules)
where newResults =
- filter legalInterval [ Iv xl (rl - 1) -- input below rule
- , Iv ((max xl rl) + d) ((min xh rh) + d)] -- input within rule
- newVals = filter legalInterval [Iv (rh + 1) xh] -- input above rule
- newRules = filter legalRule [Rule (Iv (xh + 1) rh) d] -- rule above input
+ filter legalInterval
+ [ Iv xl (rl - 1) -- input below rule
+ , Iv ((max xl rl) + d) ((min xh rh) + d)] -- input within rule
+ newVals = filter legalInterval
+ [Iv (rh + 1) xh] -- input above rule
+ newRules = filter legalRule
+ [Rule (Iv (xh + 1) rh) d] -- rule above input
useRules :: [Rule] -> [Interval] -> [Interval]