From: PHO Date: Thu, 22 Apr 2010 16:58:28 +0000 (+0900) Subject: major rename of classes X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=2c2948fbfa1b730beafa2dc8a5c6c81de54f2920;p=hs-rrdtool.git major rename of classes --- diff --git a/Database/RRDtool.hs b/Database/RRDtool.hs index a1fc0ec..6b57340 100644 --- a/Database/RRDtool.hs +++ b/Database/RRDtool.hs @@ -4,18 +4,18 @@ module Database.RRDtool , MentionedVars(..) , ApplyMentionedVarsOf(..) - , Expr - , CommonExpr + , IsExpr + , IsCommonExpr , IterativeExpr - , AggregativeExpr + , IsAggregativeExpr - , ExprSet - , CommonExprSet + , IsExprSet + , IsCommonExprSet , Constant(..) - , VarName(..) + , IsVarName(..) , Variable(..) - , VariableSet + , IsVariableSet , CommonUnaryOp(..) , CommonBinaryOp(..) , CommonTrinaryOp(..) @@ -140,7 +140,7 @@ data DataSource -- referred to as \"virtual\" or \"computed\" columns. -- -- FIXME: doc links - | forall a. CommonExpr a => COMPUTE { + | forall a. IsCommonExpr a => COMPUTE { dsName :: !String -- |rpn-expression defines the formula used to compute the -- PDPs of a COMPUTE data source from other data sources in @@ -167,7 +167,7 @@ dsTest = COMPUTE { } -- MentionedVars -class VariableSet (MentionedVarsOf a) => MentionedVars a where +class IsVariableSet (MentionedVarsOf a) => MentionedVars a where type MentionedVarsOf a -- ApplyMentionedVarsOf @@ -177,45 +177,45 @@ instance Applyable ApplyMentionedVarsOf a where type Apply ApplyMentionedVarsOf a = MentionedVarsOf a apply = undefined --- Expr -class (Show e, Eq e) => Expr e -class Expr e => CommonExpr e -class Expr e => IterativeExpr e -class Expr e => AggregativeExpr e +-- IsExpr +class (Show e, Eq e) => IsExpr e +class IsExpr e => IsCommonExpr e +class IsExpr e => IterativeExpr e +class IsExpr e => IsAggregativeExpr e -class (Show es, Eq es, HList es) => ExprSet es -instance ExprSet HNil -instance (Expr e, ExprSet es) => ExprSet (e :*: es) +class (Show es, Eq es, HList es) => IsExprSet es +instance IsExprSet HNil +instance (IsExpr e, IsExprSet es) => IsExprSet (e :*: es) -class (Show es, Eq es, HList es) => CommonExprSet es -instance CommonExprSet HNil -instance (CommonExpr e, CommonExprSet es) => CommonExprSet (e :*: es) +class (Show es, Eq es, HList es) => IsCommonExprSet es +instance IsCommonExprSet HNil +instance (IsCommonExpr e, IsCommonExprSet es) => IsCommonExprSet (e :*: es) -- Constants and variable names data Constant = Const !Double deriving (Show, Eq, Ord) -instance Expr Constant -instance CommonExpr Constant +instance IsExpr Constant +instance IsCommonExpr Constant instance MentionedVars Constant where type MentionedVarsOf Constant = HNil -class (Show a, Eq a, Ord a) => VarName a where +class (Show a, Eq a, Ord a) => IsVarName a where varName :: a -> String data Variable vn = Variable !vn deriving (Show, Eq, Ord) -instance VarName vn => Expr (Variable vn) -instance VarName vn => CommonExpr (Variable vn) -instance VarName vn => MentionedVars (Variable vn) where +instance IsVarName vn => IsExpr (Variable vn) +instance IsVarName vn => IsCommonExpr (Variable vn) +instance IsVarName vn => MentionedVars (Variable vn) where type MentionedVarsOf (Variable vn) = vn :*: HNil -class HList vs => VariableSet vs -instance VariableSet HNil -instance (VarName v, VariableSet vs) => VariableSet (v :*: vs) +class HList vs => IsVariableSet vs +instance IsVariableSet HNil +instance (IsVarName v, IsVariableSet vs) => IsVariableSet (v :*: vs) -- Common operators data CommonUnaryOp a @@ -233,9 +233,9 @@ data CommonUnaryOp a | Rad2Deg !a | Abs !a deriving (Show, Eq, Ord) -instance Expr a => Expr (CommonUnaryOp a) -instance CommonExpr a => CommonExpr (CommonUnaryOp a) -instance VariableSet (MentionedVarsOf a) => MentionedVars (CommonUnaryOp a) where +instance IsExpr a => IsExpr (CommonUnaryOp a) +instance IsCommonExpr a => IsCommonExpr (CommonUnaryOp a) +instance IsVariableSet (MentionedVarsOf a) => MentionedVars (CommonUnaryOp a) where type MentionedVarsOf (CommonUnaryOp a) = MentionedVarsOf a data CommonBinaryOp a b @@ -256,13 +256,13 @@ data CommonBinaryOp a b | AtanXY !a !b deriving (Show, Eq, Ord) -instance (Expr a, Expr b) => - Expr (CommonBinaryOp a b) +instance (IsExpr a, IsExpr b) => + IsExpr (CommonBinaryOp a b) -instance (CommonExpr a, CommonExpr b) => - CommonExpr (CommonBinaryOp a b) +instance (IsCommonExpr a, IsCommonExpr b) => + IsCommonExpr (CommonBinaryOp a b) -instance VariableSet (MentionedVarsOf a :++: MentionedVarsOf b) => +instance IsVariableSet (MentionedVarsOf a :++: MentionedVarsOf b) => MentionedVars (CommonBinaryOp a b) where type MentionedVarsOf (CommonBinaryOp a b) = MentionedVarsOf a :++: MentionedVarsOf b @@ -273,15 +273,15 @@ data CommonTrinaryOp a b c | Limit !a !b !c deriving (Show, Eq, Ord) -instance (Expr a, Expr b, Expr c) - => Expr (CommonTrinaryOp a b c) +instance (IsExpr a, IsExpr b, IsExpr c) + => IsExpr (CommonTrinaryOp a b c) -instance (CommonExpr a, CommonExpr b, CommonExpr c) - => CommonExpr (CommonTrinaryOp a b c) +instance (IsCommonExpr a, IsCommonExpr b, IsCommonExpr c) + => IsCommonExpr (CommonTrinaryOp a b c) -instance VariableSet (MentionedVarsOf a :++: - MentionedVarsOf b :++: - MentionedVarsOf c) => +instance IsVariableSet (MentionedVarsOf a :++: + MentionedVarsOf b :++: + MentionedVarsOf c) => MentionedVars (CommonTrinaryOp a b c) where type MentionedVarsOf (CommonTrinaryOp a b c) = MentionedVarsOf a :++: @@ -295,9 +295,9 @@ data CommonSetOp es = AverageOf !es deriving (Show, Eq, Ord) -instance ExprSet es => Expr (CommonSetOp es) -instance (ExprSet es, CommonExprSet es) => CommonExpr (CommonSetOp es) -instance VariableSet (HConcat (HMap ApplyMentionedVarsOf es)) => +instance IsExprSet es => IsExpr (CommonSetOp es) +instance (IsExprSet es, IsCommonExprSet es) => IsCommonExpr (CommonSetOp es) +instance IsVariableSet (HConcat (HMap ApplyMentionedVarsOf es)) => MentionedVars (CommonSetOp es) where type MentionedVarsOf (CommonSetOp es) = HConcat (HMap ApplyMentionedVarsOf es) @@ -306,21 +306,21 @@ data TrendOp vn a = Trend !(Variable vn) !a | TrendNan !(Variable vn) !a deriving (Show, Eq, Ord) -instance (VarName vn, Expr a) => Expr (TrendOp vn a) -instance (VarName vn, CommonExpr a) => CommonExpr (TrendOp vn a) -instance (VarName vn, MentionedVars a) => MentionedVars (TrendOp vn a) where +instance (IsVarName vn, IsExpr a) => IsExpr (TrendOp vn a) +instance (IsVarName vn, IsCommonExpr a) => IsCommonExpr (TrendOp vn a) +instance (IsVarName vn, MentionedVars a) => MentionedVars (TrendOp vn a) where type MentionedVarsOf (TrendOp vn a) = vn :*: MentionedVarsOf a data VariableShiftPredictOp ss w vn = VariableShiftPredictAverage !ss !w !(Variable vn) | VariableShiftPredictSigma !ss !w !(Variable vn) deriving (Show, Eq, Ord) -instance (ExprSet ss, Expr w, VarName vn) - => Expr (VariableShiftPredictOp ss w vn) -instance (ExprSet ss, CommonExprSet ss, CommonExpr w, VarName vn) - => CommonExpr (VariableShiftPredictOp ss w vn) -instance ( VarName vn - , VariableSet (MentionedVarsOf ss :++: MentionedVarsOf w) +instance (IsExprSet ss, IsExpr w, IsVarName vn) + => IsExpr (VariableShiftPredictOp ss w vn) +instance (IsExprSet ss, IsCommonExprSet ss, IsCommonExpr w, IsVarName vn) + => IsCommonExpr (VariableShiftPredictOp ss w vn) +instance ( IsVarName vn + , IsVariableSet (MentionedVarsOf ss :++: MentionedVarsOf w) ) => MentionedVars (VariableShiftPredictOp ss w vn) where type MentionedVarsOf (VariableShiftPredictOp ss w vn) = vn :*: (MentionedVarsOf ss :++: MentionedVarsOf w) @@ -331,14 +331,14 @@ data FixedShiftPredictOp sm w vn | FixedShiftPredictSigma !sm !w !(Variable vn) deriving (Show, Eq, Ord) -instance (Expr sm, Expr w, VarName vn) - => Expr (FixedShiftPredictOp sm w vn) +instance (IsExpr sm, IsExpr w, IsVarName vn) + => IsExpr (FixedShiftPredictOp sm w vn) -instance (CommonExpr sm, CommonExpr w, VarName vn) - => CommonExpr (FixedShiftPredictOp sm w vn) +instance (IsCommonExpr sm, IsCommonExpr w, IsVarName vn) + => IsCommonExpr (FixedShiftPredictOp sm w vn) -instance ( VarName vn - , VariableSet (MentionedVarsOf sm :++: MentionedVarsOf w) +instance ( IsVarName vn + , IsVariableSet (MentionedVarsOf sm :++: MentionedVarsOf w) ) => MentionedVars (FixedShiftPredictOp sm w vn) where type MentionedVarsOf (FixedShiftPredictOp sm w vn) = vn :*: (MentionedVarsOf sm :++: MentionedVarsOf w) @@ -351,9 +351,9 @@ data CommonValue | Now deriving (Show, Eq, Ord) -instance Expr CommonValue +instance IsExpr CommonValue -instance CommonExpr CommonValue +instance IsCommonExpr CommonValue instance MentionedVars CommonValue where type MentionedVarsOf CommonValue = HNil @@ -366,7 +366,7 @@ data IterativeValue | TakenLocalTime deriving (Show, Eq, Ord) -instance Expr IterativeValue +instance IsExpr IterativeValue instance IterativeExpr IterativeValue @@ -378,11 +378,11 @@ data IterativeValueOf vn = PreviousOf !(Variable vn) deriving (Show, Eq, Ord) -instance VarName vn => Expr (IterativeValueOf vn) +instance IsVarName vn => IsExpr (IterativeValueOf vn) -instance VarName vn => IterativeExpr (IterativeValueOf vn) +instance IsVarName vn => IterativeExpr (IterativeValueOf vn) -instance VarName vn => MentionedVars (IterativeValueOf vn) where +instance IsVarName vn => MentionedVars (IterativeValueOf vn) where type MentionedVarsOf (IterativeValueOf vn) = vn :*: HNil -- Aggregative operators (fairly restricted due to rrdtool's @@ -402,11 +402,11 @@ data AggregativeUnaryOp vn | LSLCorrel !(Variable vn) deriving (Show, Eq, Ord) -instance VarName vn => Expr (AggregativeUnaryOp vn) +instance IsVarName vn => IsExpr (AggregativeUnaryOp vn) -instance VarName vn => AggregativeExpr (AggregativeUnaryOp vn) +instance IsVarName vn => IsAggregativeExpr (AggregativeUnaryOp vn) -instance VarName vn => MentionedVars (AggregativeUnaryOp vn) where +instance IsVarName vn => MentionedVars (AggregativeUnaryOp vn) where type MentionedVarsOf (AggregativeUnaryOp vn) = vn :*: HNil -- |The 'createRRD' function lets you set up new Round Robin Database