, HConcat
, HMap
+
+ , HLength
)
where
, HConcatable(..)
, HMappable(..)
- , HLength(..)
+ , HLength
)
where
hMap f (HCons x xs) = hCons (apply f x) (hMap f xs)
-- HLength
-class IntegerT (HLengthOf l) => HLength l where
- type HLengthOf l
- hLength :: Integral n => l -> n
-
-instance HLength HNil where
- type HLengthOf HNil = D0
- hLength _ = 0
-
-instance ( HLength l
- , IntegerT (Succ (HLengthOf l))
- ) => HLength (HCons e l) where
- type HLengthOf (HCons e l) = Succ (HLengthOf l)
- hLength (HCons _ l) = 1 + hLength l
+type family HLength l
+type instance HLength HNil = D0
+type instance HLength (HCons e l) = Succ (HLength l)
import Types.Data.Num.Ops
-class HString s
+class (Show s, Eq s) => HString s
instance HString HNil
-instance IntegerT c => HString (HCons c s)
+instance ( Show c
+ , Show s
+ , Eq c
+ , Eq s
+ , IntegerT c
+ )
+ => HString (HCons c s)
hString :: QuasiQuoter
hString = QuasiQuoter quoteStrExp quoteStrPat
-- Database.RRDtool.Expression
, Constant(..)
- , IsVarName(..)
+ , IsVarName
, Variable(..)
, CommonUnaryOp(..)
, CommonBinaryOp(..)
, IsCommonExprSet
, Constant(..)
- , IsVarName(..)
+ , IsVarName
, Variable(..)
, IsVariableSet
, CommonUnaryOp(..)
where
import Data.HList
+import Data.HList.String
-- MentionedVars
instance MentionedVars Constant where
type MentionedVarsOf Constant = HNil
-class (Show a, Eq a, Ord a) => IsVarName a where
- varName :: a -> String
+{- This is what we want to do but GHC can't handle this for now.
+class ( (HLengthOf a :<=: D255) ~ True
+ , HString a
+ )
+ => IsVarName a
+-}
+class HString a => IsVarName a
data Variable vn
= Variable !vn