| Copyright | (c) Double Crown Gaming Co. 2020 |
|---|---|
| License | BSD3 |
| Maintainer | jesse.kempf@doublecrown.co |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Dataflow
Description
Timely Dataflow in pure Haskell.
Synopsis
- data Dataflow a
- data Edge a
- data Timestamp
- data StateRef a
- send :: Edge input -> Timestamp -> input -> Dataflow ()
- readState :: StateRef a -> Dataflow a
- writeState :: StateRef a -> a -> Dataflow ()
- modifyState :: StateRef a -> (a -> a) -> Dataflow ()
- statefulVertex :: state -> (StateRef state -> Timestamp -> i -> Dataflow ()) -> (StateRef state -> Timestamp -> Dataflow ()) -> Dataflow (Edge i)
- statelessVertex :: (Timestamp -> i -> Dataflow ()) -> Dataflow (Edge i)
- outputTVar :: (o -> w -> w) -> TVar w -> Dataflow (Edge o)
- trace :: Show i => Edge i -> Dataflow (Edge i)
- discard :: Dataflow (Edge i)
- data Program i
- compile :: MonadIO io => Dataflow (Edge i) -> io (Program i)
- execute :: (MonadIO io, Traversable t) => t i -> Program i -> io (Program i)
Documentation
Dataflow is the type of all dataflow operations.
Since: 0.1.0.0
An Edge is a typed reference to a computational vertex that
takes as as its input.
Since: 0.1.0.0
Timestamps represent instants in the causal timeline.
Since: 0.1.0.0
Instances
| Eq Timestamp Source # | |
| Ord Timestamp Source # | |
| Show Timestamp Source # | |
| Hashable Timestamp Source # | |
Defined in Dataflow.Primitives | |
send :: Edge input -> Timestamp -> input -> Dataflow () Source #
Send an input item to be worked on to the indicated vertex.
Since: 0.1.0.0
writeState :: StateRef a -> a -> Dataflow () Source #
Overwrite the value stored in the StateRef.
Since: 0.1.0.0
modifyState :: StateRef a -> (a -> a) -> Dataflow () Source #
Update the value stored in StateRef.
Since: 0.1.0.0
Arguments
| :: 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.
Since: 0.1.0.0
statelessVertex :: (Timestamp -> i -> Dataflow ()) -> Dataflow (Edge i) Source #
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.
Since: 0.1.0.0
trace :: Show i => Edge i -> Dataflow (Edge i) Source #
Construct a vertex that pretty-prints items and passes them through unchanged.
Since: 0.1.2.0
discard :: Dataflow (Edge i) Source #
Construct a vertex that discards anything sent to it.
Since: 0.1.2.0