on develop help sign in
Expose alignEventWithMaybe
db1dd70Ryan Trinkle
src/Reflex/Class.hs+5−6
@@ -47,6 +47,7 @@ module Reflex.Class
47 , mergeList
47 , mergeList
48 , mergeWith
48 , mergeWith
49 , difference
49 , difference
50+ , alignEventWithMaybe
50 -- ** Breaking up 'Event's
51 -- ** Breaking up 'Event's
51 , splitE
52 , splitE
52 , fanEither
53 , fanEither
@@ -751,7 +752,7 @@ switchPromptOnly e0 e' = do
751
752
752instance Reflex t => Align (Event t) where
753instance Reflex t => Align (Event t) where
753 nil = never
754 nil = never
754− align = alignWithMaybe Just
755+ align = alignEventWithMaybe Just
755
756
756-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
757-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
757-- the 'Behavior' is true at the time of occurence.
758-- the 'Behavior' is true at the time of occurence.
@@ -818,14 +819,12 @@ distributeListOverDynWith f = fmap (f . map (\(Const2 _ :=> Identity v) -> v) .
818-- | Create a new 'Event' that occurs when the first supplied 'Event' occurs
819-- | Create a new 'Event' that occurs when the first supplied 'Event' occurs
819-- unless the second supplied 'Event' occurs simultaneously.
820-- unless the second supplied 'Event' occurs simultaneously.
820difference :: Reflex t => Event t a -> Event t b -> Event t a
821difference :: Reflex t => Event t a -> Event t b -> Event t a
821−difference = alignWithMaybe $ \case
822+difference = alignEventWithMaybe $ \case
822 This a -> Just a
823 This a -> Just a
823 _ -> Nothing
824 _ -> Nothing
824
825
825−-- (intentially not exported, for now)
826−alignWithMaybe
827− :: Reflex t => (These a b -> Maybe c) -> Event t a -> Event t b -> Event t c
826+alignEventWithMaybe :: Reflex t => (These a b -> Maybe c) -> Event t a -> Event t b -> Event t c
828−alignWithMaybe f ea eb =
827+alignEventWithMaybe f ea eb =
829 fmapMaybe (f <=< dmapToThese)
828 fmapMaybe (f <=< dmapToThese)
830 $ merge
829 $ merge
831 $ DMap.fromList [LeftTag :=> ea, RightTag :=> eb]
830 $ DMap.fromList [LeftTag :=> ea, RightTag :=> eb]