Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Note: this is experimental code. It's what I'm using to build my own Gtk apps. That being said, you may find IO more often than it's really necessary. I'd be glad if you could point that out when you see it. I'd like to make this code as generic and useful as possible.
| This module holds the protected reactive program model. It holds a reactive model, but includes an interface that is thread safe (can be called concurrently). This makes it easier for different threads to modify the model without having to worry about concurrency. Note that using this interface can lead to deadlocks in the program.
- data Event b => ProtectedModel a b
- startProtectedModel :: Event b => a -> IO (ProtectedModel a b)
- onReactiveModel :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> c) -> IO c
- onEvent :: Event b => ProtectedModel a b -> b -> IO () -> IO ()
- onEvents :: (Foldable container, Event b) => ProtectedModel a b -> container b -> IO () -> IO ()
- applyToReactiveModel :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> ReactiveModelIO a b) -> IO ()
- fromReactiveModel :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> (ReactiveModelIO a b, c)) -> IO c
- waitFor :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> Bool) -> IO ()
Documentation
data Event b => ProtectedModel a b Source
Construction
startProtectedModel :: Event b => a -> IO (ProtectedModel a b) Source
Start executing the a new protected model.
Access
onReactiveModel :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> c) -> IO c Source
Calculate a value from the reactive model.
onEvent :: Event b => ProtectedModel a b -> b -> IO () -> IO () Source
Execute an event handler for a given Event.
onEvents :: (Foldable container, Event b) => ProtectedModel a b -> container b -> IO () -> IO () Source
Execute an event handler for a given Event.
applyToReactiveModel :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> ReactiveModelIO a b) -> IO () Source
Perform a modification to the underlying reactive model.
fromReactiveModel :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> (ReactiveModelIO a b, c)) -> IO c Source
Calculate a value from the reactive model and update it at the same time