-data CommonBinaryOp a b where
- (:<: ) :: !a -> !b -> CommonBinaryOp a b
- (:<=:) :: !a -> !b -> CommonBinaryOp a b
-instance (Expr a, Expr b) => Expr (CommonBinaryOp a b)
-instance (CommonExpr a, CommonExpr b) => CommonExpr (CommonBinaryOp a b)
+data CommonUnaryOp a
+ = IsUnknown !a
+ | IsInfinity !a
+ | Sin !a
+ | Cos !a
+ | Log !a
+ | Exp !a
+ | Sqrt !a
+ | Atan !a
+ | Floor !a
+ | Ceil !a
+ | Deg2Rad !a
+ | Rad2Deg !a
+ | Abs !a
+ deriving (Show, Eq, Ord)
+instance Expr a => Expr (CommonUnaryOp a)
+instance CommonExpr a => CommonExpr (CommonUnaryOp a)
+
+data CommonBinaryOp a b
+ = !a :<: !b
+ | !a :<=: !b
+ | !a :>: !b
+ | !a :>=: !b
+ | !a :==: !b
+ | !a :/=: !b
+ | Min !a !b
+ | Max !a !b
+ | !a :+: !b
+ | !a :-: !b
+ | !a :*: !b
+ | !a :/: !b
+ | !a :%: !b
+ | AddNaN !a !b
+ | AtanXY !a !b
+ deriving (Show, Eq, Ord)
+instance (Expr a, Expr b)
+ => Expr (CommonBinaryOp a b)
+instance (CommonExpr a, CommonExpr b)
+ => CommonExpr (CommonBinaryOp a b)
+
+data CommonTrinaryOp a b c
+ = If !a !b !c
+ | Limit !a !b !c
+ deriving (Show, Eq, Ord)
+instance (Expr a, Expr b, Expr c)
+ => Expr (CommonTrinaryOp a b c)
+instance (CommonExpr a, CommonExpr b, CommonExpr c)
+ => CommonExpr (CommonTrinaryOp a b c)
+
+-- SORT and REV can't be expressed in this way as they pushes possibly
+-- multiple values onto the stack...
+
+data CommonSetOp es
+ = Average !es
+ deriving (Show, Eq, Ord)
+instance ExprSet es => Expr (CommonSetOp es)
+instance CommonExprSet es => CommonExpr (CommonSetOp es)