monad-loops-stm-0.4: Monadic loops for STM

Safe HaskellSafe-Inferred

Control.Monad.Loops.STM

Synopsis

Documentation

atomLoop :: STM a -> IO ()Source

forever and atomically rolled into one.

waitFor :: (a -> Bool) -> STM a -> STM aSource

retry until the given condition is true of the given value. Then return the value that satisfied the condition.

waitForTrue :: STM Bool -> STM ()Source

retry until the given value is True.

waitForJust :: STM (Maybe a) -> STM aSource

retry until the given value is Just _, returning the contained value.

waitForEvent :: (a -> Bool) -> TChan a -> STM aSource

waitFor a value satisfying a condition to come out of a TChan, reading and discarding everything else. Returns the winner.