EmptyDataDecls,
FlexibleInstances,
TypeFamilies,
+ TypeOperators,
MultiParamTypeClasses,
UndecidableInstances
#-}
, IsIterativeExpr
, IsVarName
+ , hString
, Constant(..)
, Variable(..)
where
import Data.HList
+import Data.HList.String
import Types.Data.Bool
import Types.Data.Num hiding ((:*:))
import Types.Data.Ord
type instance MentionedVars Constant = HNil
{- This is what we want to do but GHC can't handle this for now.
-class ( (HLengthOf str :<=: D255) ~ True
+class ( (HLengthOf str :<=: D19) ~ True
, HString str
)
=> IsVarName str
-}
type family IsVarName str
-type instance IsVarName str = ( (HLength str :<=: D255)
+type instance IsVarName str = ( (HLength str :>: D0)
+ :&&:
+ (HLength str :<=: D19)
:&&:
(HAll IsGoodLetterForVarNameA str)
)
type family IsGoodLetterForVarName c
type instance IsGoodLetterForVarName c = ( ((c :>=: D65) :&&: (c :<=: D90)) -- A-Z
:||:
- ((c :>=: D99) :&&: (c :<=: D122)) -- a-z
+ ((c :>=: D97) :&&: (c :<=: D122)) -- a-z
:||:
(c :==: D45) -- '-'
:||:
type Apply IsGoodLetterForVarNameA c = IsGoodLetterForVarName c
-- Variable
-data Variable vn
- = Variable !vn
- deriving (Show, Eq, Ord)
+data Variable vn = Var !vn
+ deriving (Show, Eq, Ord)
type instance IsExpr (Variable vn) = True
type instance IsCommonExpr (Variable vn) = True
type instance IsIterativeExpr (Variable vn) = True
-type instance MentionedVars (Variable vn) = vn :*: HNil
+type instance MentionedVars (Variable vn) = vn :&: HNil
type family IsVariableSet vs
type instance IsVariableSet HNil = True
type instance IsExpr (TrendOp vn e) = IsVarName vn :&&: IsExpr e
type instance IsCommonExpr (TrendOp vn e) = IsVarName vn :&&: IsCommonExpr e
type instance IsIterativeExpr (TrendOp vn e) = IsVarName vn :&&: IsIterativeExpr e
-type instance MentionedVars (TrendOp vn e) = vn :*: MentionedVars e
+type instance MentionedVars (TrendOp vn e) = vn :&: MentionedVars e
-- VariableShiftPredictOp
data VariableShiftPredictOp ss w vn
= IsIterativeExprSet ss :&&: IsIterativeExpr w :&&: IsVarName vn
type instance MentionedVars (VariableShiftPredictOp ss w vn)
- = vn :*: (MentionedVars ss :++: MentionedVars w)
+ = vn :&: (MentionedVars ss :++: MentionedVars w)
-- FixedShiftPredictOp
data FixedShiftPredictOp sm w vn
= IsIterativeExpr sm :&&: IsIterativeExpr w :&&: IsVarName vn
type instance MentionedVars (FixedShiftPredictOp sm w vn)
- = vn :*: (MentionedVars sm :++: MentionedVars w)
+ = vn :&: (MentionedVars sm :++: MentionedVars w)
-- Common special values
data CommonValue
type instance IsExpr (IterativeValueOf vn) = IsVarName vn
type instance IsCommonExpr (IterativeValueOf vn) = False
type instance IsIterativeExpr (IterativeValueOf vn) = IsVarName vn
-type instance MentionedVars (IterativeValueOf vn) = vn :*: HNil
+type instance MentionedVars (IterativeValueOf vn) = vn :&: HNil
-- Aggregative operators (fairly restricted due to rrdtool's
-- restriction)
| LSLCorrel !(Variable vn)
deriving (Show, Eq, Ord)
-type instance MentionedVars (AggregativeUnaryOp vn) = vn :*: HNil
+type instance MentionedVars (AggregativeUnaryOp vn) = vn :&: HNil