/** * Databoard */ data Binding // Private class Serializable a where getBinding :: Binding /** * Reading graph */ data Resource data ReadGraph // Private class ReadTransaction where getGraph :: ReadGraph resource :: ReadTransaction => String -> Resource (#) :: ReadTransaction => Resource -> Resource -> [Resource] valueOf :: ReadTransaction => Serializable a => Resource -> a /** * Writing graph */ data WriteGraph // Private data Graph a = Graph (WriteGraph -> a) instance Monad Graph where return x = Graph (\_ -> x) Graph g >>= f = \wg -> f (g wg) wg map f (Graph g) = Graph (f . g) newResource :: Graph Resource newResource = Graph __WriteGraph_newResource newLiteral :: Serializable a => a -> Graph Resource newLiteral = Graph (\wg -> literal = __WriteGraph_newResource wg _ = __WriteGraph_claimValue wg literal a getBinding literal ) statement :: Resource -> Resource -> Resource -> Graph () statement s p o = Graph (\wg -> __WriteGraph_claim wg s p o)