rhine- Functional Reactive Programming with type-level clocks

Safe HaskellSafe




data Wait diff a Source #

A functor implementing a syntactical "waiting" action.

  • diff represents the duration to wait.
  • a is the encapsulated value.


Wait diff a 


Functor (Wait diff) Source # 


fmap :: (a -> b) -> Wait diff a -> Wait diff b #

(<$) :: a -> Wait diff b -> Wait diff a #

type ScheduleT diff = FreeT (Wait diff) Source #

Values in ScheduleT diff m are delayed computations with side effects in m. Delays can occur between any two side effects, with lengths specified by a diff value. These delays don't have any semantics, it can be given to them with runScheduleT.

wait :: Monad m => diff -> ScheduleT diff m () Source #

The side effect that waits for a specified amount.

runScheduleT :: Monad m => (diff -> m ()) -> ScheduleT diff m a -> m a Source #

Supply a semantic meaning to Wait. For every occurrence of Wait diff in the ScheduleT diff m a value, a waiting action is executed, depending on diff.

runScheduleIO :: (MonadIO m, Integral n) => ScheduleT n m a -> m a Source #

Run a ScheduleT value in a MonadIO, interpreting the times as milliseconds.

race :: (Ord diff, Num diff, Monad m) => ScheduleT diff m a -> ScheduleT diff m b -> ScheduleT diff m (Either (a, ScheduleT diff m b) (ScheduleT diff m a, b)) Source #

Runs two values in ScheduleT concurrently and returns the first one that yields a value (defaulting to the first argument), and a continuation for the other value.

async :: (Ord diff, Num diff, Monad m) => ScheduleT diff m a -> ScheduleT diff m b -> ScheduleT diff m (a, b) Source #

Runs both schedules concurrently and returns their results at the end.