Safe Haskell | None |
---|---|

Language | Haskell2010 |

Helper functions for dealing with events

## Synopsis

- eventJoin :: (Reflex t, MonadHold t m) => Event t (Event t a) -> m (Event t a)
- noNothing :: (Filterable f, Filterable f) => f (Maybe a) -> f a
- holdEvent :: (DomBuilder t m, MonadHold t m) => b -> Event t a -> (a -> m b) -> m (Dynamic t b)
- holdEvent_ :: (DomBuilder t m, MonadHold t m) => Event t a -> (a -> m b) -> m ()
- switchTup :: Reflex t => Dynamic t (Event t b, Event t c) -> (Event t b, Event t c)
- holdAfter :: (PostBuild t m, DomBuilder t m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => b -> Event t a -> (a -> Event t a -> m b) -> m (Dynamic t b)
- flash :: (Monoid c, DomBuilder t m, PerformEvent t m, MonadHold t m, TriggerEvent t m, MonadIO (Performable m)) => Event t b -> (b -> m c) -> m (Dynamic t c)
- flash' :: (DomBuilder t m, PerformEvent t m, MonadHold t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> c -> Event t b -> (b -> m c) -> m (Dynamic t c)
- evtText :: (DomBuilder t m, PostBuild t m, MonadHold t m) => Event t Text -> m ()
- gatePrism :: Reflex t => Prism' a b -> Event t a -> Event t b
- blockFalse :: Reflex t => Event t Bool -> Event t ()

# Documentation

noNothing :: (Filterable f, Filterable f) => f (Maybe a) -> f a Source #

Block those nothing events and only let trough `Just`

values

holdEvent :: (DomBuilder t m, MonadHold t m) => b -> Event t a -> (a -> m b) -> m (Dynamic t b) Source #

Do something monadic with an event val Because of haskell lazyness the things inside a holdevent don't get evaluated untill the event fires, which makes the first time slow. However it is good for initialization as we don't need to load things unused.

holdEvent_ :: (DomBuilder t m, MonadHold t m) => Event t a -> (a -> m b) -> m () Source #

Convenience holdEvent for the case where we don't care about the value.

switchTup :: Reflex t => Dynamic t (Event t b, Event t c) -> (Event t b, Event t c) Source #

Get rid of a dynimc around a tupple of events, common sense says we should be able to do this for any traversable, but keeping the values of events hetrogenous is hard (I don't know how to)

holdAfter :: (PostBuild t m, DomBuilder t m, MonadHold t m, PerformEvent t m, TriggerEvent t m, MonadIO (Performable m)) => b -> Event t a -> (a -> Event t a -> m b) -> m (Dynamic t b) Source #

Do something monadic with an event val, and get the event which is delayed for a moment. Using this may indicate you're doing something weird. Although I've found it handy in getting just something to work

flash :: (Monoid c, DomBuilder t m, PerformEvent t m, MonadHold t m, TriggerEvent t m, MonadIO (Performable m)) => Event t b -> (b -> m c) -> m (Dynamic t c) Source #

show something for 5 seconds after an event

flash' :: (DomBuilder t m, PerformEvent t m, MonadHold t m, TriggerEvent t m, MonadIO (Performable m)) => NominalDiffTime -> c -> Event t b -> (b -> m c) -> m (Dynamic t c) Source #