on develop help sign in
Use align (a merge) instead of coincidence for <.> (#346)
commit710c8508b9ab3baf8164f8fb4df8f5e347c0efe7 authorOliver Batchelor <saulzar@gmail.com> dateTue 20 Aug 2019, 02:29 (7 years ago) parent3a6f208
1 file changed+6−3
src/Reflex/Class.hs+6−3
src/Reflex/Class.hs+6−3
@@ -714,9 +714,12 @@ filterRight = mapMaybe (either (const Nothing) Just)
714714instance Reflex t => Alt (Event t) where
715715 ev1 <!> ev2 = leftmost [ev1, ev2]
716716
717−-- | 'Event' intersection (convenient interface to 'coincidence').
717+-- | 'Event' intersection. Only occurs when both events are co-incident.
718718instance 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+
720723
721724-- | 'Event' intersection (convenient interface to 'coincidence').
722725instance Reflex t => Bind (Event t) where
@@ -1073,7 +1076,7 @@ instance Reflex t => Align (Event t) where
10731076instance Reflex t => Semialign (Event t) where
10741077#endif
10751078 align = alignEventWithMaybe Just
1076−
1079+
10771080#if defined(MIN_VERSION_semialign)
10781081 zip x y = mapMaybe justThese $ align x y
10791082#endif