-- combine :: (Expr, Value) -> (Expr, Value) -> [(Expr, Value)]
-- combine (e1,v1) (e2,v2) = [(App op e1 e2, apply op v1 v2) | op <- ops, legal op v1 v2]
--                        ++ [(App op e2 e1, apply op v2 v1) | op <- ops, legal op v2 v1]
--                        where ops = [Add,Sub,Mul,Div]

combine :: (Expr, Value) -> (Expr, Value) -> [(Expr, Value)]
combine (e1,v1) (e2,v2)
  | v1 < v2  = comb1 (e1,v1) (e2,v2)
  | v1 == v2 = comb2 (e1,v1) (e2,v2)
  | v1 > v2  = comb1 (e2,v2) (e1,v1)
combine :: (Expr, Value) -> (Expr, Value) -> [(Expr, Value)]
combine (e1,v1) (e2,v2)
  | v1 < v2  = comb1 (e1,v1) (e2,v2)
  | v1 == v2 = comb2 (e1,v1) (e2,v2)
  | v1 > v2  = comb1 (e2,v2) (e1,v1)
combine (e1,v1) (e2,v2)
  | v1 < v2  = comb1 (e1,v1) (e2,v2)
  | v1 == v2 = comb2 (e1,v1) (e2,v2)
  | v1 > v2  = comb1 (e2,v2) (e1,v1)