@@ -731,10 +731,9 @@ mergeWith = mergeWith' id
732{-# INLINE mergeWith' #-}
732{-# INLINE mergeWith' #-}
733mergeWith' :: Reflex t => (a -> b) -> (b -> b -> b) -> [Event t a] -> Event t b
733mergeWith' :: Reflex t => (a -> b) -> (b -> b -> b) -> [Event t a] -> Event t b
734−mergeWith' f g es = fmap (Prelude.foldl1 g . map (\(Const2 _ :=> Identity v) -> f v) . DMap.toList)
734+mergeWith' f g es = fmap (Prelude.foldl1 g . fmap f)
735− . merge
735+ . mergeInt
736− . DMap.fromDistinctAscList
736+ . IntMap.fromDistinctAscList
737− . map (\(k, v) -> Const2 k :=> v)
738 $ zip [0 :: Int ..] es
737 $ zip [0 :: Int ..] es
740-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
739-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
@@ -968,6 +967,8 @@ mapAccumMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (a, c)
968mapAccumMB f = mapAccumMaybeMB $ \v o -> bimap Just Just <$> f v o
967mapAccumMB f = mapAccumMaybeMB $ \v o -> bimap Just Just <$> f v o
969mapAccumMaybeB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c)
968mapAccumMaybeB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c)
970mapAccumMaybeB f = mapAccumMaybeMB $ \v o -> return $ f v o
969mapAccumMaybeB f = mapAccumMaybeMB $ \v o -> return $ f v o
971+{-# INLINABLE mapAccumMaybeMB #-}
971mapAccumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c)
972mapAccumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a, Maybe c)) -> a -> Event t b -> m (Behavior t a, Event t c)
972mapAccumMaybeMB f z e = do
973mapAccumMaybeMB f z e = do
973 rec let e' = flip push e $ \o -> do
974 rec let e' = flip push e $ \o -> do
@@ -1186,10 +1187,9 @@ mergeWithCheap' f g = mergeWithFoldCheap' $ foldl1 g . fmap f
1186{-# INLINE mergeWithFoldCheap' #-}
1187{-# INLINE mergeWithFoldCheap' #-}
1187mergeWithFoldCheap' :: Reflex t => (NonEmpty a -> b) -> [Event t a] -> Event t b
1188mergeWithFoldCheap' :: Reflex t => (NonEmpty a -> b) -> [Event t a] -> Event t b
1188mergeWithFoldCheap' f es =
1189mergeWithFoldCheap' f es =
1189− fmapCheap (f . (\(h : t) -> h :| t) . map (\(Const2 _ :=> Identity v) -> v) . DMap.toList)
1190+ fmapCheap (f . (\(h : t) -> h :| t) . IntMap.elems)
1190− . merge
1191+ . mergeInt
1191− . DMap.fromDistinctAscList
1192+ . IntMap.fromDistinctAscList
1192− . map (\(k, v) -> Const2 k :=> v)
1193 $ zip [0 :: Int ..] es
1193 $ zip [0 :: Int ..] es
1195--------------------------------------------------------------------------------
1195--------------------------------------------------------------------------------