I have a function 'evalRule' that applies rules to steps in a backtracking search optimization problem and evaluates the step's fitness or decides that it must be eliminated entirely.
In the following, a result of Nothing means "eliminate the step," Just x means the step has fitness score x.
evalRule :: Rule -> Step -> Maybe Double
I would like to write a function that applies a bunch of rules but short-circuits the computation if it hits Nothing. However, unlike the way the Maybe monad works, I want to know the partial results.
In the following, the rules are applied in order and the "Just" results are collected up the point where a rule returns Nothing.
evalRules :: [Rule] -> Step -> [Double]
What's a nice way to do this?
D