reflex-dom-contrib-0.3: A playground for experimenting with infrastructure and common code for reflex applications

Safe HaskellNone
LanguageHaskell2010

Reflex.Contrib.Utils

Synopsis

Documentation

end :: Monad m => m () Source

A small amount of convenience for return ().

fmapMaybe2 :: Reflex t => Event t (Maybe (Maybe a)) -> Event t a Source

fmapMaybe twice

attachDynSelf :: Reflex t => Dynamic t a -> Event t (a, a) Source

Construct an event with a tuple of (current,updated).

partitionEvent :: Reflex t => (a -> Bool) -> Event t a -> (Event t a, Event t a) Source

Partitions an event into a pair of events that fire when the predicate function evaluates to True and False respectively.

extractEvent :: (Reflex t, MonadHold t m) => (a -> Event t b) -> Dynamic t a -> m (Event t b) Source

Sometimes you end up with a Dynamic t Foo where Foo contains an Event field. This function collapses the two levels of Dynamic Event into just an Event.

extractDyn :: (Reflex t, MonadHold t m) => (a -> Dynamic t b) -> Dynamic t a -> m (Dynamic t b) Source

Sometimes you end up with a Dynamic t Foo where Foo contains a Dynamic field. This function collapses the two levels of Dynamic Dynamic into a single Dynamic.

filterDyn :: (MonadHold t m, Reflex t, Functor m) => (a -> Bool) -> Dynamic t a -> m (Dynamic t a) Source

This function has the slight flaw that if (f initValue) == False, it will still get through.

fmapMaybeDyn :: (MonadHold t m, Reflex t, Functor m) => (a -> Maybe b) -> Dynamic t a -> m (Dynamic t (Maybe b)) Source

Similar to filterDyn, but here the initial value problem is visible because of the Maybe.