on develop help sign in
Use align (a merge) instead of coincidence for <.> (#346)
710c850Oliver Batchelor
src/Reflex/Class.hs+6−3
@@ -714,9 +714,12 @@ filterRight = mapMaybe (either (const Nothing) Just)
714instance Reflex t => Alt (Event t) where
714instance Reflex t => Alt (Event t) where
715 ev1 <!> ev2 = leftmost [ev1, ev2]
715 ev1 <!> ev2 = leftmost [ev1, ev2]
716
716
717−-- | 'Event' intersection (convenient interface to 'coincidence').
717+-- | 'Event' intersection. Only occurs when both events are co-incident.
718instance Reflex t => Apply (Event t) where
718instance Reflex t => Apply (Event t) where
719− evf <.> evx = coincidence (fmap (<$> evx) evf)
719+ evf <.> evx = mapMaybe f (align evf evx) where
720+ f (These g a) = Just (g a)
721+ f _ = Nothing
722+
720
723
721-- | 'Event' intersection (convenient interface to 'coincidence').
724-- | 'Event' intersection (convenient interface to 'coincidence').
722instance Reflex t => Bind (Event t) where
725instance Reflex t => Bind (Event t) where
@@ -1073,7 +1076,7 @@ instance Reflex t => Align (Event t) where
1073instance Reflex t => Semialign (Event t) where
1076instance Reflex t => Semialign (Event t) where
1074#endif
1077#endif
1075 align = alignEventWithMaybe Just
1078 align = alignEventWithMaybe Just
1076−
1079+
1077#if defined(MIN_VERSION_semialign)
1080#if defined(MIN_VERSION_semialign)
1078 zip x y = mapMaybe justThese $ align x y
1081 zip x y = mapMaybe justThese $ align x y
1079#endif
1082#endif