--- /dev/null
+{-# LANGUAGE
+ FlexibleContexts,
+ FlexibleInstances,
+ TypeFamilies
+ #-}
+module Data.HList.Graph
+ ( HNodeSet
+ , HNode(..)
+ , HGraph(..)
+ )
+ where
+
+import Data.HList.Prelude
+
+-- HNodeSet
+class HNodeSet ns
+instance HNodeSet HNil
+instance HNodeSet ns => HNodeSet (HCons n ns)
+
+-- HNode
+class ( HNodeSet (HLinksFrom n)
+ )
+ => HNode n
+ where
+ type HNodeID n
+ type HLinksFrom n
+
+-- HGraph
+class ( HNodeSet (HNodes g)
+ )
+ => HGraph g
+ where
+ type HNodes g
{-# LANGUAGE
FlexibleContexts,
FlexibleInstances,
+ GADTs,
+ OverlappingInstances,
TypeFamilies,
UndecidableInstances
#-}
+{-# LANGUAGE QuasiQuotes #-} -- DELETE THIS
module Database.RRDtool.Create
( DataSource
, ExternalDSType(..)
newtype RRDInterval = RRDInterval NominalDiffTime
class RRDSpec s
-instance ( HOccurs RRDPath s
- , HOccursOpt KeepOldRRD s
- , HOccursOpt RRDStartTime s
- , HOccursOpt RRDInterval s
+instance ( HOccurs RRDPath s
+ , HOccursOpt KeepOldRRD s
+ , HOccursOpt RRDStartTime s
+ , HOccursOpt RRDInterval s
)
=> RRDSpec s
+class NonEmptyDSList l
+instance ( DSList l
+ , DataSource ds
+ )
+ => NonEmptyDSList (HCons ds l)
+
+class DSList l
+instance DSList HNil
+instance ( DSList l
+ , DataSource ds
+ )
+ => DSList (HCons ds l)
+
+-- DataList would be a graph...
+
-- |The 'createRRD' function lets you set up new Round Robin Database
-- (RRD) files. The file is created at its final, full size and filled
-- with @*UNKNOWN*@ data.
-createRRD :: RRDSpec s => s -> IO ()
+createRRD :: ( RRDSpec s
+ , NonEmptyDSList l
+ )
+ => s -> l -> IO ()
createRRD = error "FIXME"
testMain :: IO ()
testMain = let s = RRDPath "test.rrd" .&.
KeepOldRRD .&.
HNil
+ x = ComputedDataSource {
+ cdsName = [$hString|foo|]
+ , cdsExpr = Const 100
+ }
+ d = x .&. HNil
in
- createRRD s
+ createRRD s d