TypeCompose-0.0: Type composition classes & instancesSource codeContentsIndex
Control.DataDriven
Portabilityportable
Stabilityexperimental
Maintainerconal@conal.net
Contents
Plumbing for "events" and subscription
Data-driven computations
Description
Data-driven computations
Synopsis
type Sink src a = a -> Updater src
type Updater src = src ()
type News src = Sink src (Updater src)
type DataDrivenG news src = Compose ((,) news) src
dd :: news -> src a -> DataDrivenG news src a
mapSrc :: (src a -> src b) -> DataDrivenG news src a -> DataDrivenG news src b
type DataDriven src = DataDrivenG (News src) src
runDD :: (Monoid (Updater src), Applicative src) => DataDriven src () -> Updater src
joinDD :: Monad src => DataDriven src (src a) -> DataDriven src a
Plumbing for "events" and subscription
type Sink src a = a -> Updater srcSource
Sinks (consumers) of values
type Updater src = src ()Source
Updaters (actions)
type News src = Sink src (Updater src)Source
News publisher -- somewhere to register updaters to be executed when events occur.
Data-driven computations
type DataDrivenG news src = Compose ((,) news) srcSource
The general type of data-driven computations. Represented as a news publisher (news) and a source of new values (src). Clients interested in the value subscribe to news and extract a new value from src when notified that the value may have changed. When news is a monoid and src is an applicative functor, DataDriven news src is an applicative functor also. The applicative property is very convenient for composition. See the more specific type DataDriven.
dd :: news -> src a -> DataDrivenG news src aSource
Construct a data-driven computation from a subscription service (Monoid) and a value source subscriber (Applicative).
mapSrc :: (src a -> src b) -> DataDrivenG news src a -> DataDrivenG news src bSource
Modify the source part of a DataDriven computation.
type DataDriven src = DataDrivenG (News src) srcSource
Data driven with news publisher
runDD :: (Monoid (Updater src), Applicative src) => DataDriven src () -> Updater srcSource
Run a unit-valued DataDriven computation. Causes the source to be executed and registered with the subscriber.
joinDD :: Monad src => DataDriven src (src a) -> DataDriven src aSource
Apply join to a source
Produced by Haddock version 2.3.0