dataflower-0.2.2.0: A Pure-Haskell Timely Dataflow System

Copyright(c) Double Crown Gaming Co. 2020
LicenseBSD3
Maintainerjesse.kempf@doublecrown.co
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Dataflow

Description

Timely Dataflow in pure Haskell.

Synopsis

Documentation

data Dataflow a Source #

Dataflow is the type of all dataflow operations.

Since: 0.1.0.0

Instances
Monad Dataflow Source # 
Instance details

Defined in Dataflow.Primitives

Methods

(>>=) :: Dataflow a -> (a -> Dataflow b) -> Dataflow b #

(>>) :: Dataflow a -> Dataflow b -> Dataflow b #

return :: a -> Dataflow a #

fail :: String -> Dataflow a #

Functor Dataflow Source # 
Instance details

Defined in Dataflow.Primitives

Methods

fmap :: (a -> b) -> Dataflow a -> Dataflow b #

(<$) :: a -> Dataflow b -> Dataflow a #

Applicative Dataflow Source # 
Instance details

Defined in Dataflow.Primitives

Methods

pure :: a -> Dataflow a #

(<*>) :: Dataflow (a -> b) -> Dataflow a -> Dataflow b #

liftA2 :: (a -> b -> c) -> Dataflow a -> Dataflow b -> Dataflow c #

(*>) :: Dataflow a -> Dataflow b -> Dataflow b #

(<*) :: Dataflow a -> Dataflow b -> Dataflow a #

data Edge a Source #

An Edge is a typed reference to a computational vertex that takes as as its input.

Since: 0.1.0.0

data Timestamp Source #

Timestamps represent instants in the causal timeline.

Since: 0.1.0.0

data StateRef a Source #

Mutable state that holds an a.

Since: 0.1.0.0

send :: Edge input -> Timestamp -> input -> Dataflow () Source #

Send an input item to be worked on to the indicated vertex.

Since: 0.1.0.0

readState :: StateRef a -> Dataflow a Source #

Read the value stored in the StateRef.

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

statefulVertex Source #

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

outputTVar :: (o -> w -> w) -> TVar w -> Dataflow (Edge o) Source #

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.

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

data Program i Source #

A Program represents a fully-preprocessed Dataflow that may be executed against inputs.

Since: 0.1.0.0

compile :: MonadIO io => Dataflow (Edge i) -> io (Program i) Source #

Take a Dataflow which takes is as input and compile it into a Program.

Since: 0.1.0.0

execute :: (MonadIO io, Traversable t) => t i -> Program i -> io (Program i) Source #

Feed a traversable collection of inputs to a Program. All inputs provided will have the same Timestamp associated with them.

Since: 0.1.0.0