Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
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
- 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.
Session | |
|
:: 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.
:: 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.
:: 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.
:: 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.
:: (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.
Low level
sessionStop :: Session m a b -> IO ()Source
Clean up a wire session.