Safe Haskell | None |
---|---|
Language | Haskell2010 |
Small experimental library for interactive functional programs.
- data X a
- data E a
- newtype Output = Output (IO ())
- runProgram :: IO () -> E () -> [Output] -> IO ()
- edge :: X a -> (a -> a -> Maybe b) -> E b
- accumulate :: E a -> s -> (a -> s -> s) -> X s
- snapshot :: E a -> X b -> E (a, b)
- snapshot_ :: E a -> X b -> E b
- out :: E a -> (a -> IO ()) -> Output
- filterE :: (a -> Bool) -> E a -> E a
- justE :: E (Maybe a) -> E a
- maybeE :: (a -> Maybe b) -> E a -> E b
- never :: E a
- debugX :: (Eq a, Show a) => X a -> Output
- debugE :: Show a => E a -> Output
- newX :: a -> IO (a -> IO (), X a)
- newE :: IO (a -> IO (), E a)
Documentation
:: IO () | action to execute after initialization |
-> E () | event that will shutdown the system |
-> [Output] | set of output event handlers to run |
-> IO () |
Run a set of Outputs. This spawns several threads then waits for an event. The output threads will then be killed to stop further processing. However other threads which no longer have any effect will probably remain, taking up resources. After threads have been spawned but before waiting, the given "boot" action will be executed.
edge :: X a -> (a -> a -> Maybe b) -> E b Source
Events will occur when an "edge" is detected in a signal. The detection algorithm checks the two values before and after a discrete change in the signal.
accumulate :: E a -> s -> (a -> s -> s) -> X s Source
Create a signal out of an input event and a state machine.
snapshot :: E a -> X b -> E (a, b) Source
An event which gets the value of a signal when another event occurs.