on develop help sign in
Add eventjoin
976e89dJappie Klooster
src/Reflex/Class.hs+5
@@ -63,6 +63,7 @@ module Reflex.Class
63 , factorEvent
63 , factorEvent
64 , filterEventKey
64 , filterEventKey
65 -- ** Collapsing 'Event . Event'
65 -- ** Collapsing 'Event . Event'
66+ , eventJoin
66 , switchHold
67 , switchHold
67 , switchHoldPromptly
68 , switchHoldPromptly
68 , switchHoldPromptOnly
69 , switchHoldPromptOnly
@@ -817,6 +818,10 @@ fanThese e =
817fanMap :: (Reflex t, Ord k) => Event t (Map k a) -> EventSelector t (Const2 k a)
818fanMap :: (Reflex t, Ord k) => Event t (Map k a) -> EventSelector t (Const2 k a)
818fanMap = fan . fmap mapToDMap
819fanMap = fan . fmap mapToDMap
819
820
821+-- | switcHold never = eventjoin
822+eventJoin :: (Reflex t, MonadHold t m) => Event t (Event t a) -> m (Event t a)
823+eventJoin = switchHold never
824+
820-- | Switches to the new event whenever it receives one. Only the old event is
825-- | Switches to the new event whenever it receives one. Only the old event is
821-- considered the moment a new one is switched in; the output event will fire at
826-- considered the moment a new one is switched in; the output event will fire at
822-- that moment if only if the old event does.
827-- that moment if only if the old event does.