netwire-3.1.0: Fast generic automaton arrow transformer for AFRP

MaintainerErtugrul Soeylemez <es@ertes.de>

Control.Wire.Session

Contents

Description

Wire sessions, i.e. running and/or testing wires.

Synopsis

Running wires

stepWireSource

Arguments

:: WireToGen >~ 
=> Wire e >~ a b

Wire to step.

-> a >~ (Either e b, Wire e >~ a b) 

Performs an instant of the given wire.

stepWireMSource

Arguments

:: Monad m 
=> Wire e (Kleisli m) a b

Wire to step.

-> a

Input signal.

-> m (Either e b, Wire e (Kleisli m) a b) 

Performs an instant of the given monad-based wire.

Testing wires

testWireSource

Arguments

:: forall a e m (>~) . (ArrowApply >~, ArrowKleisli m >~, MonadIO m, Show e, WireToGen >~) 
=> Int

Frames per output. Speed/accuracy tradeoff.

-> (() >~ a)

Input generator.

-> Wire e >~ a String >~ () 

Test a wire. This function runs the given wire continuously printing its output on a single line.

The first argument specifies how often the wire's result is printed. If you specify 100 here, then the output is printed at every 100th frame.

testWireMSource

Arguments

:: forall a e m . (Show e, MonadIO m) 
=> Int

Frames per output. FPS/accuracy tradeoff.

-> m a

Input generator.

-> Wire e (Kleisli m) a String 
-> m () 

Test a monad-based wire. This function runs the given wire continuously printing its output on a single line.

The first argument specifies how often the wire's result is printed. If you specify 100 here, then the output is printed at every 100th frame.

Utility functions

printInt :: (Num a, Ord a) => a -> a -> String -> IO aSource

Print a wire result on one line at regular intervals (first argument). The second argument is the interval counter.

printRes :: String -> IO ()Source

Print a wire result on one line.

showRes :: Show e => Either e String -> StringSource

Turn a wire result into a string for printing.

succMod :: (Num a, Ord a) => a -> a -> aSource

Increments. Results in 0, if the result is greater than or equal to the first argument.