@@ -605,15 +605,22 @@ mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
605605
606606-- | Split the event into separate events for 'Left' and 'Right' values.
607607fanEither :: Reflex t => Event t (Either a b) -> (Event t a, Event t b)
608−fanEither e = let justLeft = either Just (const Nothing)
609− justRight = either (const Nothing) Just
610− in
611− (fmapMaybe justLeft e, fmapMaybe justRight e)
608+fanEither e =
609+ let justLeft = either Just (const Nothing)
610+ justRight = either (const Nothing) Just
611+ in (fmapMaybe justLeft e, fmapMaybe justRight e)
612612
613613-- | Split the event into separate events for 'This' and 'That' values,
614614-- allowing them to fire simultaneously when the input value is 'These'.
615615fanThese :: Reflex t => Event t (These a b) -> (Event t a, Event t b)
616−fanThese e = (fmapMaybe justThis e, fmapMaybe justThat e)
616+fanThese e =
617+ let this (This x) = Just x
618+ this (These x _) = Just x
619+ this _ = Nothing
620+ that (That y) = Just y
621+ that (These _ y) = Just y
622+ that _ = Nothing
623+ in (fmapMaybe this e, fmapMaybe that e)
617624
618625-- | Split the event into an 'EventSelector' that allows efficient selection of
619626-- the individual 'Event's.