You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I've found this function quite useful. The naming reflects its similarity to monadic bind but I'm open to suggestions for alternative names:
bindEvent :: (MonadFix m, Adjustable t m, MonadHold t m)
=> m (Event t a) -> (a -> m (Event t b)) -> m (Event t b)
bindEvent first secondFun = do
rec
let becomeSecondEv = fmap secondFun firstEv
(firstEv, secondEvEv) <- runWithReplace first becomeSecondEv
switchEvent secondEvEv
where switchEvent is from reflex-frp/reflex#49:
switchEvent :: (Reflex t, MonadHold t m) => Event t (Event t a) -> m (Event t a)
switchEvent = fmap switch . hold never
I've used it for creating login widgets that behave similarly to Google's (username and password entry are two separate widgets where the second's creation is triggered by the first).
The type is convenient for creating long chains of widgets that dynamically update while carrying along the payload from previous widgets' events.
The text was updated successfully, but these errors were encountered:
Hi. I've found this function quite useful. The naming reflects its similarity to monadic bind but I'm open to suggestions for alternative names:
bindEvent :: (MonadFix m, Adjustable t m, MonadHold t m)
=> m (Event t a) -> (a -> m (Event t b)) -> m (Event t b)
bindEvent first secondFun = do
rec
let becomeSecondEv = fmap secondFun firstEv
(firstEv, secondEvEv) <- runWithReplace first becomeSecondEv
switchEvent secondEvEv
where switchEvent is from reflex-frp/reflex#49:
switchEvent :: (Reflex t, MonadHold t m) => Event t (Event t a) -> m (Event t a)
switchEvent = fmap switch . hold never
I've used it for creating login widgets that behave similarly to Google's (username and password entry are two separate widgets where the second's creation is triggered by the first).
The type is convenient for creating long chains of widgets that dynamically update while carrying along the payload from previous widgets' events.
The text was updated successfully, but these errors were encountered: