keera-hails-mvc-model-protectedmodel-0.0.3.5: Rapid Gtk Application Development - Protected Reactive Models

Safe HaskellSafe-Inferred
LanguageHaskell98

Hails.MVC.Model.ProtectedModel

Contents

Description

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.

Synopsis

Documentation

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

waitFor :: Event b => ProtectedModel a b -> (ReactiveModelIO a b -> Bool) -> IO () Source

Lock the calling thread until the reactive model fulfills a condition.