netwire-1.2.4: Arrowized FRP implementation

MaintainerErtugrul Soeylemez <es@ertes.de>

FRP.NetWire.Session

Contents

Description

Wire sessions.

Synopsis

Sessions

data Session m a b Source

Reactive sessions with the given input and output types over the given monad. The monad must have a MonadControlIO instance to be usable with the stepping functions.

Constructors

Session 

Fields

sessFreeVar :: TVar Bool

False, if in use.

sessStateRef :: IORef (WireState m)

State of the last instant.

sessTimeRef :: IORef UTCTime

Time of the last instant.

sessWireRef :: IORef (Wire m a b)

Wire for the next instant.

stepWireSource

Arguments

:: MonadControlIO m 
=> a

Input value.

-> Session m a b

Session to step.

-> m (Output b)

System's output.

Feed the given input value into the reactive system performing the next instant using real time.

stepWireDeltaSource

Arguments

:: MonadControlIO m 
=> NominalDiffTime

Time delta.

-> a

Input value.

-> Session m a b

Session to step.

-> m (Output b)

System's output.

Feed the given input value into the reactive system performing the next instant using the given time delta.

stepWireTimeSource

Arguments

:: MonadControlIO m 
=> UTCTime

Absolute time of the instant to perform.

-> a

Input value.

-> Session m a b

Session to step.

-> m (Output b)

System's output.

Feed the given input value into the reactive system performing the next instant, which is at the given time. This function is thread-safe.

stepWireTime'Source

Arguments

:: MonadIO m 
=> UTCTime

Absolute time of the instant to perform.

-> a

Input value.

-> Session m a b

Session to step.

-> m (Output b)

System's output.

Feed the given input value into the reactive system performing the next instant, which is at the given time. This function is not thread-safe.

withWireSource

Arguments

:: MonadControlIO m 
=> Wire m a b

Initial wire of the session.

-> (Session m a b -> m c)

Continuation, which receives the session data.

-> m c

Continuation's result.

Initialize a reactive session and pass it to the given continuation.

Low level

sessionStart :: MonadIO m => Wire m a b -> m (Session m a b)Source

Start a wire session.

sessionStop :: MonadIO m => Session m a b -> m ()Source

Clean up a wire session.