<div dir="auto">Personally, I'm old-fashioned. I don't mind having to press a button to make it go. But my preferences are obviously not the end of the discussion.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 24, 2018, 3:15 PM Joachim Breitner <<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Am Dienstag, den 24.07.2018, 14:47 -0400 schrieb Joachim Breitner:<br>
> I guess I can use <br>
> <a href="https://hackage.haskell.org/package/reflex-dom-0.3/candidate/docs/Reflex-Dom-Time.html" rel="noreferrer noreferrer" target="_blank">https://hackage.haskell.org/package/reflex-dom-0.3/candidate/docs/Reflex-Dom-Time.html</a><br>
> for this somehow. But I guess I only want to delay errors, not<br>
> successes – I will give it a shot<br>
<br>
Sure, why not:<br>
<a href="https://github.com/nomeata/free-theorems-static-webui/commit/20c9aca" rel="noreferrer noreferrer" target="_blank">https://github.com/nomeata/free-theorems-static-webui/commit/20c9aca</a><br>
<br>
it seems to work. If some reflex-expert could check if this makes<br>
sense, that would be great:<br>
<br>
-- | Errors are delayed, but successes go through immediatelly<br>
delayError :: (PerformEvent t m, MonadHold t m, TriggerEvent t m, MonadIO (Performable m)) =><br>
Dynamic t (Either a b) -> m (Dynamic t (Either a b))<br>
delayError d = do<br>
delayedEvents <- delay 0.5 (updated d)<br>
d' <- holdDyn Nothing (Just <$> delayedEvents)<br>
return $ do<br>
now <- d<br>
past <- d'<br>
return $ case (past, now) of<br>
(Nothing, _) -> now -- before any delayed events arrive<br>
(_, Right _ ) -> now -- current value is good<br>
(Just x, Left _) -> x -- current value is bad, delay<br>
<br>
Cheers,<br>
Joachim<br>
<br>
-- <br>
Joachim Breitner<br>
<a href="mailto:mail@joachim-breitner.de" target="_blank" rel="noreferrer">mail@joachim-breitner.de</a><br>
<a href="http://www.joachim-breitner.de/" rel="noreferrer noreferrer" target="_blank">http://www.joachim-breitner.de/</a><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>