Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
Arrowized FRP implementation for networking applications. The aim of this library is to provide a convenient FRP implementation, which should enable you to write entirely pure network sessions.
- data Wire
- type Output = Either SomeException
- type Time = Double
- mkGen :: (WireState m -> a -> m (Output b, Wire m a b)) -> Wire m a b
- toGen :: Monad m => Wire m a b -> WireState m -> a -> m (Output b, Wire m a b)
- data Session 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)
- withWire :: (MonadControlIO m, MonadIO sm) => Wire sm a b -> (Session sm a b -> m c) -> m c
- type SF = Wire Identity
- stepSF :: Time -> a -> SF a b -> (Output b, SF a b)
- stepWirePure :: Monad m => Time -> a -> Wire m a b -> m (Output b, Wire m a b)
- data InhibitException = InhibitException String
- inhibitEx :: String -> SomeException
- noEvent :: SomeException
- module FRP.NetWire.Analyze
- module FRP.NetWire.Calculus
- module FRP.NetWire.Concurrent
- module FRP.NetWire.Event
- module FRP.NetWire.IO
- module FRP.NetWire.Random
- module FRP.NetWire.Request
- module FRP.NetWire.Switch
- module FRP.NetWire.Tools
- module Control.Monad.IO.Class
- module Control.Monad.IO.Control
- module Data.Functor.Identity
Wires
A wire is a network of signal transformers.
Monad m => Arrow (Wire m) | Arrow interface to signal networks. |
Monad m => ArrowZero (Wire m) | The zero arrow always inhibits. |
Monad m => ArrowPlus (Wire m) | Left-biased signal network combination. If the left arrow inhibits, the right arrow is tried. If both inhibit, their combination inhibits. |
Monad m => ArrowChoice (Wire m) | Signal routing. Unused routes are frozen, until they are put back into use. |
MonadFix m => ArrowLoop (Wire m) | Value recursion. Warning: Recursive signal networks must never
inhibit. Make use of |
Monad m => Category (Wire m) | Identity signal network and signal network sequencing. |
Monad m => Functor (Wire m a) | Map over the result of a signal network. |
Monad m => Applicative (Wire m a) | Applicative interface to signal networks. |
Monad m => Alternative (Wire m a) | This instance corresponds to the |
type Output = Either SomeExceptionSource
Functor for output signals.
mkGen :: (WireState m -> a -> m (Output b, Wire m a b)) -> Wire m a bSource
Create a generic wire from the given function. This is a smart
constructor. Please use it instead of the WGen
constructor.
toGen :: Monad m => Wire m a b -> WireState m -> a -> m (Output b, Wire m a b)Source
Extract the transition function of a wire.
Reactive 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.
:: 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.
:: (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.
Pure wires
stepSF :: Time -> a -> SF a b -> (Output b, SF a b)Source
Perform the next instant of a pure wire over the identity monad.
stepWirePure :: Monad m => Time -> a -> Wire m a b -> m (Output b, Wire m a b)Source
Perform the next instant of a pure wire.
Inhibition
data InhibitException Source
Inhibition exception with an informative message. This exception is the result of signal inhibition, where no further exception information is available.
inhibitEx :: String -> SomeExceptionSource
Construct an InhibitException
wrapped in a SomeException
.
noEvent :: SomeExceptionSource
Construct an InhibitException
wrapped in a SomeException
with a
message indicating that a certain event did not happen.
Netwire Reexports
module FRP.NetWire.Analyze
module FRP.NetWire.Calculus
module FRP.NetWire.Concurrent
module FRP.NetWire.Event
module FRP.NetWire.IO
module FRP.NetWire.Random
module FRP.NetWire.Request
module FRP.NetWire.Switch
module FRP.NetWire.Tools
Other convenience reexports
module Control.Monad.IO.Class
module Control.Monad.IO.Control
module Data.Functor.Identity