+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
+ = AverageOf !es
+ deriving (Show, Eq, Ord)
+instance ExprSet es => Expr (CommonSetOp es)
+instance CommonExprSet es => CommonExpr (CommonSetOp es)
+
+data TrendOp v a
+ = Trend !v !a
+ | TrendNan !v !a
+ deriving (Show, Eq, Ord)
+instance (Variable v, Expr a) => Expr (TrendOp v a)
+instance (Variable v, CommonExpr a) => CommonExpr (TrendOp v a)
+
+data VariableShiftPredictOp ss w v
+ = VariableShiftPredictAverage !ss !w !v
+ | VariableShiftPredictSigma !ss !w !v
+ deriving (Show, Eq, Ord)
+instance (ExprSet ss, Expr w, Variable v)
+ => Expr (VariableShiftPredictOp ss w v)
+instance (CommonExprSet ss, CommonExpr w, Variable v)
+ => CommonExpr (VariableShiftPredictOp ss w v)
+
+data FixedShiftPredictOp sm w v
+ = FixedShiftPredictAverage !sm !w !v
+ | FixedShiftPredictSigma !sm !w !v
+ deriving (Show, Eq, Ord)
+instance (Expr sm, Expr w, Variable v)
+ => Expr (FixedShiftPredictOp sm w v)
+instance (CommonExpr sm, CommonExpr w, Variable v)
+ => CommonExpr (FixedShiftPredictOp sm w v)
+
+-- Common special values
+data CommonValue
+ = Unknown
+ | Infinity
+ | NegativeInfinity
+ | Now
+ deriving (Show, Eq, Ord)
+instance Expr CommonValue
+instance CommonExpr CommonValue