]> gitweb @ CieloNegro.org - hs-rrdtool.git/blobdiff - Database/RRDtool/Create.hs
major rename
[hs-rrdtool.git] / Database / RRDtool / Create.hs
index 28c0bfd357dc77ca5d81a0bb42985b07b6b4a54c..f07797acf5f2dadc9c976cc611f457e4065d0aa4 100644 (file)
@@ -17,7 +17,7 @@ module Database.RRDtool.Create
 
     -- Data.HList
     , (.&.)
-    , HNil(..)
+    , Nil(..)
 
     -- Database.RRDtool.Expression
     , Constant(..)
@@ -136,7 +136,7 @@ instance ( IsVarName vn ~ True
     where
       type DSName (ExternalDataSource vn) = vn
 
-type instance MentionedVars (ExternalDataSource vn) = HNil
+type instance MentionedVars (ExternalDataSource vn) = Nil
 
 -- |ComputedDataSource is for storing the result of a formula applied
 -- to other data sources in the RRD. This data source is not supplied
@@ -184,7 +184,7 @@ dsTest = ComputedDataSource {
            cdsName = "foo"
 --         , cdsExpr = Previous :<: Const 100
 --         , cdsExpr = Var "foo" :<: Const 100
-         , cdsExpr = AverageOf (Const 100 .*. Const 200 .*. HNil)
+         , cdsExpr = AverageOf (Const 100 .*. Const 200 .*. Nil)
          }
 -}
 
@@ -205,11 +205,11 @@ newtype RRDStartTime = RRDStartTime POSIXTime
 newtype RRDInterval = RRDInterval NominalDiffTime
 
 class RRDSpec s
-instance ( HOccurs    RRDPath        s
-         , HOccursOpt KeepOldRRD     s
-         , HOccursOpt RRDStartTime   s
-         , HOccursOpt RRDInterval    s
-         , HOccurs    RRDDataSources s
+instance ( Occurs    RRDPath        s
+         , OccursOpt KeepOldRRD     s
+         , OccursOpt RRDStartTime   s
+         , OccursOpt RRDInterval    s
+         , Occurs    RRDDataSources s
          )
     => RRDSpec s
 
@@ -217,38 +217,42 @@ class NonEmptyDSList l
 instance ( DSList l
          , DataSource d
          )
-    => NonEmptyDSList (HCons d l)
+    => NonEmptyDSList (Cons d l)
 
 class DSList l
-instance DSList HNil
+instance DSList Nil
 instance ( DSList l
          , DataSource d
          )
-    => DSList (HCons d l)
+    => DSList (Cons d l)
 
 data RRDDataSources
     = forall l.
       ( NonEmptyDSList l
-      , HGraph l -- FIXME: this constraint is too weak
+      , Graph l -- FIXME: this constraint is too weak
       )
     => RRDDataSources l
 
 -- RRDDataSources is a graph.
 instance ( DSList g
-         , HNodeSet g
-         , HNoDuplicates (HMap HNodeIDA g)
+         , NodeSet g
+         , NoDuplicates (Map NodeIDA g)
          )
-    => HGraph g
+    => Graph g
     where
-      type HNodes g = g
+      type Empty g = Nil
+      type Nodes g = g
 
-instance ( HNodeIDSet (MentionedVars d)
+type instance IsEmpty Nil        = True
+type instance IsEmpty (Cons e l) = False
+
+instance ( NodeIDSet (MentionedVars d)
          , DataSource d
          )
-    => HNode d
+    => Node d
     where
-      type HNodeID d    = DSName d
-      type HLinksFrom d = MentionedVars d
+      type NodeID d    = DSName d
+      type LinksFrom d = MentionedVars d
 
 -- |The 'createRRD' function lets you set up new Round Robin Database
 -- (RRD) files. The file is created at its final, full size and filled
@@ -262,7 +266,7 @@ testMain :: IO ()
 testMain = let s = RRDPath "test.rrd" .&.
                    KeepOldRRD         .&.
                    RRDDataSources testDSList .&.
-                   HNil
+                   Nil
            in
              createRRD s
 
@@ -278,4 +282,4 @@ testDSList = let a = ComputedDataSource {
                        cdsName = [$hString|baz|]
                      , cdsExpr = Var [$hString|foo|] -- should typecheck!
                      }
-             in a .&. b .&. HNil
\ No newline at end of file
+             in a .&. b .&. Nil
\ No newline at end of file