Skip to content

Commit 710c850

Browse files
Use align (a merge) instead of coincidence for <.> (#346)
1 parent 3a6f208 commit 710c850

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Reflex/Class.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,12 @@ filterRight = mapMaybe (either (const Nothing) Just)
714714
instance 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.
718718
instance 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').
722725
instance Reflex t => Bind (Event t) where
@@ -1073,7 +1076,7 @@ instance Reflex t => Align (Event t) where
10731076
instance 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

0 commit comments

Comments
 (0)