-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Pure-Haskell Timely Dataflow System -- -- See README @package dataflower @version 0.1.0.0 -- | Timely Dataflow in pure Haskell. module Dataflow -- | Dataflow is the type of all dataflow operations. data Dataflow a -- | An Edge is a typed reference to a computational vertex that -- takes as as its input. data Edge a -- | Timestamps represent instants in the causal timeline. data Timestamp -- | Mutable state that holds an a. data StateRef a -- | Send an input item to be worked on to the indicated vertex. send :: Typeable input => Edge input -> Timestamp -> input -> Dataflow () -- | Read the value stored in the StateRef. readState :: StateRef a -> Dataflow a -- | Overwrite the value stored in the StateRef. writeState :: StateRef a -> a -> Dataflow () -- | Update the value stored in StateRef. modifyState :: StateRef a -> (a -> a) -> Dataflow () -- | Construct a vertex with internal state. Like statelessVertex, -- statefulVertex requires a procedure to invoke on each input. It -- also needs an initial state value and a procedure to call -- when all inputs for a given Timestamp value have been -- delivered. -- -- NB: Until the finalizer has been called for a particular timestamp, a -- stateful vertex must be capable of accepting data for multiple -- timestamps simultaneously. statefulVertex :: Typeable i => state -> (StateRef state -> Timestamp -> i -> Dataflow ()) -> (StateRef state -> Timestamp -> Dataflow ()) -> Dataflow (Edge i) -- | Construct a vertex with no internal state. The given procedure is -- invoked on each input. -- -- sending to a stateless vertex is effectively a function call -- and will execute in the caller's thread. By design this is a cheap -- operation. statelessVertex :: Typeable i => (Timestamp -> i -> Dataflow ()) -> Dataflow (Edge i) -- | Construct an output vertex that stores items into the provided -- TVar. The first argument is an update function so that, for -- example, the TVar could contain a list of os and the -- update function could then cons new items onto the list. outputTVar :: Typeable o => (o -> w -> w) -> TVar w -> Dataflow (Edge o) -- | A Program represents a fully-preprocessed Dataflow that -- may be executed against inputs. data Program i -- | Take a Dataflow which takes is as input and compile it -- into a Program. compile :: Dataflow (Edge i) -> IO (Program i) -- | Feed a traversable collection of inputs to a Program. All -- inputs provided will have the same Timestamp associated with -- them. execute :: (Traversable t, Typeable i) => t i -> Program i -> IO () module Test.Dataflow runDataflow :: (Typeable i, Typeable o, MonadIO io) => (Edge o -> Dataflow (Edge i)) -> [i] -> io [o]