rhine-0.6.0: Functional Reactive Programming with type-level clocks

Safe HaskellNone
LanguageHaskell2010

FRP.Rhine.Schedule.Concurrently

Description

Many clocks tick at nondeterministic times (such as event sources), and it is thus impossible to schedule them deterministically with most other clocks. Using concurrency, they can still be scheduled with all clocks in IO, by running the clocks in separate threads.

Synopsis

Documentation

concurrently :: (Clock IO cl1, Clock IO cl2, Time cl1 ~ Time cl2) => Schedule IO cl1 cl2 Source #

Runs two clocks in separate GHC threads and collects the results in the foreground thread. Caution: The data processing will still happen in the same thread (since data processing and scheduling are separated concerns).

concurrentlyWriter :: (Monoid w, Clock (WriterT w IO) cl1, Clock (WriterT w IO) cl2, Time cl1 ~ Time cl2) => Schedule (WriterT w IO) cl1 cl2 Source #

As concurrently, but in the WriterT w IO monad. Both background threads share a joint variable with the foreground to which the writer effect writes.

concurrentlyExcept :: (Clock (ExceptT e IO) cl1, Clock (ExceptT e IO) cl2, Time cl1 ~ Time cl2) => Schedule (ExceptT e IO) cl1 cl2 Source #

Schedule in the ExceptT e IO monad. Whenever one clock encounters an exception in ExceptT, this exception is thrown in the other clock's ExceptT layer as well, and in the schedule's (i.e. in the main clock's) thread.

concurrentlyMaybe :: (Clock (MaybeT IO) cl1, Clock (MaybeT IO) cl2, Time cl1 ~ Time cl2) => Schedule (MaybeT IO) cl1 cl2 Source #

As concurrentlyExcept, with a single possible exception value.