Copyright | (c) David Janssen 2019 |
---|---|
License | MIT |
Maintainer | janssen.dhj@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
For certain KMonad operations we need to be able to pause and resume processing of events. This component provides the ability to temporarily pause processing, and then resume processing and return all events that were caught while paused.
Synopsis
- data Sluice
- mkSluice :: MonadUnliftIO m => m KeyEvent -> ContT r m Sluice
- block :: HasLogFunc e => Sluice -> RIO e ()
- unblock :: HasLogFunc e => Sluice -> RIO e [KeyEvent]
- pull :: HasLogFunc e => Sluice -> RIO e KeyEvent
Documentation
mkSluice :: MonadUnliftIO m => m KeyEvent -> ContT r m Sluice Source #
Create a new Sluice
environment, but do so in a ContT context
unblock :: HasLogFunc e => Sluice -> RIO e [KeyEvent] Source #
Set the Sluice to unblocked mode, return a list of all the stored events that should be rerun, in the correct order (head was first-in, etc).
NOTE: After successfully unblocking the Sluice
will be empty, it is the
caller's responsibility to insert the returned events at an appropriate
location in the App
.
We do this in KMonad by writing the events into the
Dispatch
s rerun buffer. (this happens in the
KMonad.App module.)