Copyright | (c) Double Crown Gaming Co. 2020 |
---|---|
License | BSD3 |
Maintainer | jesse.kempf@doublecrown.co |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Timely Dataflow in pure Haskell.
Synopsis
- data Dataflow a
- data Edge a
- data Timestamp
- data StateRef a
- send :: Typeable input => Edge input -> Timestamp -> input -> Dataflow ()
- readState :: StateRef a -> Dataflow a
- writeState :: StateRef a -> a -> Dataflow ()
- modifyState :: StateRef a -> (a -> a) -> Dataflow ()
- statefulVertex :: Typeable i => state -> (StateRef state -> Timestamp -> i -> Dataflow ()) -> (StateRef state -> Timestamp -> Dataflow ()) -> Dataflow (Edge i)
- statelessVertex :: Typeable i => (Timestamp -> i -> Dataflow ()) -> Dataflow (Edge i)
- outputTVar :: Typeable o => (o -> w -> w) -> TVar w -> Dataflow (Edge o)
- data Program i
- compile :: Dataflow (Edge i) -> IO (Program i)
- execute :: (Traversable t, Typeable i) => t i -> Program i -> IO ()
Documentation
Dataflow
is the type of all dataflow operations.
An Edge
is a typed reference to a computational vertex that
takes a
s as its input.
Timestamp
s represent instants in the causal timeline.
send :: Typeable input => Edge input -> Timestamp -> input -> Dataflow () Source #
Send an input
item to be worked on to the indicated vertex.
:: Typeable i | |
=> state | The initial state value. |
-> (StateRef state -> Timestamp -> i -> Dataflow ()) | The input handler. |
-> (StateRef state -> Timestamp -> Dataflow ()) | The finalizer. |
-> Dataflow (Edge i) |
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.
statelessVertex :: Typeable i => (Timestamp -> i -> Dataflow ()) -> Dataflow (Edge i) Source #
Construct a vertex with no internal state. The given procedure is invoked on each input.
send
ing to a stateless vertex is effectively a function call and will execute in the
caller's thread. By design this is a cheap operation.