| Maintainer | Ertugrul Soeylemez <es@ertes.de> |
|---|
FRP.NetWire.Session
Contents
Description
Wire sessions.
- data Session m a b = Session {
- sessFreeVar :: TVar Bool
- sessStateRef :: IORef (WireState m)
- sessTimeRef :: IORef UTCTime
- sessWireRef :: IORef (Wire m a b)
- stepWire :: MonadControlIO m => a -> Session m a b -> m (Output b)
- stepWireDelta :: MonadControlIO m => NominalDiffTime -> a -> Session m a b -> m (Output b)
- stepWireTime :: MonadControlIO m => UTCTime -> a -> Session m a b -> m (Output b)
- stepWireTime' :: MonadIO m => UTCTime -> a -> Session m a b -> m (Output b)
- withWire :: (MonadControlIO m, MonadIO sm) => Wire sm a b -> (Session sm a b -> m c) -> m c
- testWire :: forall a b m. (MonadControlIO m, Show b) => Int -> m a -> Wire m a b -> m ()
- testWireStr :: forall a m. MonadControlIO m => Int -> m a -> Wire m a String -> m ()
- sessionStart :: MonadIO m => Wire m a b -> IO (Session m a b)
- sessionStop :: Session m a b -> IO ()
Sessions
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
| |
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.
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.
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.
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.
Arguments
| :: (MonadControlIO m, MonadIO sm) | |
| => Wire sm a b | Initial wire of the session. |
| -> (Session sm 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.
Testing wires
Arguments
| :: forall a b m . (MonadControlIO m, Show b) | |
| => Int | Show output once each this number of frames. |
| -> m a | Input generator. |
| -> Wire m a b | Your wire. |
| -> m () |
Interface to testWireStr accepting all Show instances as the
output type.
Arguments
| :: forall a m . MonadControlIO m | |
| => Int | Show output once each this number of frames. |
| -> m a | Input generator. |
| -> Wire m a String | Wire to evolve. |
| -> m () |
This function provides a convenient way to test wires. It wraps a default loop around your wire, which just displays the output on your stdout in a single line (it uses an ANSI escape sequence to clear the line). It uses real time.
Low level
sessionStop :: Session m a b -> IO ()Source
Clean up a wire session.