Simplified some monadic code in solveConstraints

This commit is contained in:
Neil Brown 2007-12-12 14:08:09 +00:00
parent 83ee41c75c
commit 2354c6a933

View File

@ -71,11 +71,7 @@ type StIneq = StateT InequalityProblem Maybe
solveConstraints :: EqualityProblem -> InequalityProblem -> Maybe InequalityProblem
solveConstraints p ineq
= case normalise p of
Nothing -> Nothing
Just p' -> case (runStateT (solve p') ineq) of
Nothing -> Nothing
Just (_,s) -> Just s
= normalise p >>= (\p' -> execStateT (solve p') ineq)
where
normalise :: EqualityProblem -> Maybe EqualityProblem
normalise = mapM normalise' --Note the mapM; if any calls to normalise' fail, so will normalise