No title

1
2
3
4
5
6
7
-- Simplifies an expression up to a certain number of times
interpretTimes :: Maybe Integer -> (Integer,Expression) -> (Integer,Expression)
interpretTimes (Just 0) x = x
-- seq m forces the evaluation of m
interpretTimes n (m,x) = seq m $ case simplify x of
    Nothing -> (m, x)
    Just y -> interpretTimes (pred<$>n) (m+1,y)