Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
The module contains the main Wire
type.
- data Wire where
- data WireState where
- data InhibitException = InhibitException String
- type Output = Either SomeException
- type SF = Wire Identity
- type Time = Double
- cleanupWireState :: WireState m -> IO ()
- inhibitEx :: String -> SomeException
- initWireState :: MonadIO m => IO (WireState m)
- mkGen :: (WireState m -> a -> m (Output b, Wire m a b)) -> Wire m a b
- noEvent :: SomeException
- toGen :: Monad m => Wire m a b -> WireState m -> a -> m (Output b, Wire m a b)
Wires
A wire is a network of signal transformers.
WArr :: (a -> b) -> Wire m a b | |
WConst :: b -> Wire m a b | |
WGen :: (WireState m -> a -> m (Output b, Wire m a b)) -> Wire m a b | |
WId :: Wire m a a |
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. Use |
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 |
The state of the wire.
Auxilliary types
data InhibitException Source
Events are signals, which can be absent. They usually denote discrete occurences of certain events.
Inhibition exception with an informative message. This exception is the result of signal inhibition, where no further exception information is available.
type Output = Either SomeExceptionSource
Functor for output signals.
Utilities
cleanupWireState :: WireState m -> IO ()Source
Clean up wire state.
inhibitEx :: String -> SomeExceptionSource
Construct an InhibitException
wrapped in a SomeException
.
initWireState :: MonadIO m => IO (WireState m)Source
Initialize wire state.
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.
noEvent :: SomeExceptionSource
Construct an InhibitException
wrapped in a SomeException
with a
message indicating that a certain event did not happen.