TypeCompose-0.1: 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 cur a = a -> Action cur
type Action cur = cur ()
type News cur = Sink cur (Action cur)
type DataDrivenG news cur = O ((,) news) cur
dd :: cur a -> news -> DataDrivenG news cur a
mapCur :: (cur a -> cur b) -> DataDrivenG news cur a -> DataDrivenG news cur b
type DataDriven cur = DataDrivenG (News cur) cur
runDD :: (Monoid (Action cur), Applicative cur) => DataDriven cur () -> Action cur
joinDD :: Monad cur => DataDriven cur (cur a) -> DataDriven cur a
Plumbing for "events" and subscription
type Sink cur a = a -> Action curSource
Sinks (consumers) of values
type Action cur = cur ()Source
Actions
type News cur = Sink cur (Action cur)Source
News publisher -- somewhere to register updaters to be executed when events occur.
Data-driven computations
type DataDrivenG news cur = O ((,) news) curSource

The general type of data-driven computations. Represented as a news publisher (news) and a way to get new values (cur). Clients interested in the value subscribe to news and extract a new value from cur when notified that the value may have changed. When news is a monoid and cur is an applicative functor, DataDrivenG news cur is an applicative functor also. The applicative property is very convenient for composition. See the more specific type DataDriven.

Nicer, but Haddock chokes on the infix op: type DataDrivenG news cur = ((,) news) O cur

dd :: cur a -> news -> DataDrivenG news cur aSource
Construct a data-driven computation from a subscription service (Monoid) and a value source subscriber (Applicative).
mapCur :: (cur a -> cur b) -> DataDrivenG news cur a -> DataDrivenG news cur bSource
Modify the source part of a DataDriven computation.
type DataDriven cur = DataDrivenG (News cur) curSource
Data driven with news publisher
runDD :: (Monoid (Action cur), Applicative cur) => DataDriven cur () -> Action curSource
Run a unit-valued DataDriven computation. Causes the source to be executed and registered with the subscriber.
joinDD :: Monad cur => DataDriven cur (cur a) -> DataDriven cur aSource
Apply join to a source
Produced by Haddock version 2.3.0