X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=hs-rrdtool.git;a=blobdiff_plain;f=Database%2FRRDtool%2FCreate.hs;fp=Database%2FRRDtool%2FCreate.hs;h=2adeb2475a7abe86f3766eb4fff4cf5d58ed0d34;hp=5dd3b9f8fc12aadee9c64bef068dd335ee99b289;hb=c788edcf6744a51cb38795e4f1959d22d10ad071;hpb=2787678974b80d73e91b49b6b7c5469c6eb5ac1e diff --git a/Database/RRDtool/Create.hs b/Database/RRDtool/Create.hs index 5dd3b9f..2adeb24 100644 --- a/Database/RRDtool/Create.hs +++ b/Database/RRDtool/Create.hs @@ -1,9 +1,12 @@ {-# LANGUAGE FlexibleContexts, FlexibleInstances, + GADTs, + OverlappingInstances, TypeFamilies, UndecidableInstances #-} +{-# LANGUAGE QuasiQuotes #-} -- DELETE THIS module Database.RRDtool.Create ( DataSource , ExternalDSType(..) @@ -192,22 +195,45 @@ newtype RRDStartTime = RRDStartTime POSIXTime 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