Concur.Core.Patterns
- Package
- purescript-concur-core
- Repository
- purescript-concur/purescript-concur-core
#retryUntil Source
retryUntil :: forall m a. Monad m => (a -> Boolean) -> m a -> m a
Repeat a computation until the value satisfies a predicate
#retryUntilLoop Source
retryUntilLoop :: forall m a. Monad m => (a -> Boolean) -> (a -> m a) -> a -> m a
Repeat a computation until the value satisfies a predicate, looping in the previous value
#remoteWidget Source
remoteWidget :: forall m n a void. MonadEffect n => MonadAff m => MonadEffect m => Plus m => m a -> n (Tuple (m a) (m void))
Separate the effect of the widget from its result
#forkAction Source
forkAction :: forall m a b. MonadEffect m => MonadAff m => Plus m => m a -> (m a -> m b) -> m b
A common pattern - running a long running action and keeping the GUI responsive Because the action can't be restarted on every gui event, we must fork it off in the beginning
#forkActionState Source
forkActionState :: forall m s. Plus m => MonadAff m => m (s -> s) -> (s -> m s) -> (s -> m s)
Another common variant on the forkAction
pattern.
The action m (s->s)
may take a while (should not be restarted) and returns a state modification function
The gui s -> m s
takes in the current state, and modifies it on events
Note that forkActionState axn
has the shape (s -> m s) -> (s -> m s)
. So it can be "stacked" to fork multiple actions.
e.g. forkActionState axn1 $ forkActionState axn2 $ forkActionState axn3 $ render initialState
.
- Modules
- Concur.
Core - Concur.
Core. DOM - Concur.
Core. DevTools - Concur.
Core. Discharge - Concur.
Core. ElementBuilder - Concur.
Core. FRP - Concur.
Core. Gen - Concur.
Core. IsWidget - Concur.
Core. LiftWidget - Concur.
Core. Patterns - Concur.
Core. Props - Concur.
Core. Types - Control.
Cofree - Control.
MonadFix - Control.
MultiAlternative - Control.
ShiftMap