@@ -944,10 +944,6 @@ unsafeMapIncremental f g a = unsafeBuildIncremental (fmap f $ sample $ currentIn
944mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
944mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
945mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
945mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
947−-- | Like 'mergeMap' but for 'IntMap'.
948−mergeIntMap :: Reflex t => IntMap (Event t a) -> Event t (IntMap a)
949−mergeIntMap = fmap dmapToIntMap . merge . intMapWithFunctorToDMap
951-- | Create a merge whose parents can change over time
947-- | Create a merge whose parents can change over time
952mergeMapIncremental :: (Reflex t, Ord k) => Incremental t (PatchMap k (Event t a)) -> Event t (Map k a)
948mergeMapIncremental :: (Reflex t, Ord k) => Incremental t (PatchMap k (Event t a)) -> Event t (Map k a)
953mergeMapIncremental = fmap dmapToMap . mergeIncremental . unsafeMapIncremental mapWithFunctorToDMap (const2PatchDMapWith id)
949mergeMapIncremental = fmap dmapToMap . mergeIncremental . unsafeMapIncremental mapWithFunctorToDMap (const2PatchDMapWith id)
@@ -1032,19 +1028,19 @@ switchHoldPromptOnly e0 e' = do
1033-- | When the given outer event fires, condense the inner events into the contained patch. Non-firing inner events will be replaced with deletions.
1029-- | When the given outer event fires, condense the inner events into the contained patch. Non-firing inner events will be replaced with deletions.
1034coincidencePatchMap :: (Reflex t, Ord k) => Event t (PatchMap k (Event t v)) -> Event t (PatchMap k v)
1030coincidencePatchMap :: (Reflex t, Ord k) => Event t (PatchMap k (Event t v)) -> Event t (PatchMap k v)
1035−coincidencePatchMap e = fmapCheap PatchMap $ coincidence $ ffor e $ \(PatchMap m) -> mergeMap $ ffor m $ \case
1031+coincidencePatchMap e = fmapCheap PatchMap $ coincidence $ fforCheap e $ \(PatchMap m) -> mergeMap $ ffor m $ \case
1036 Nothing -> fmapCheap (const Nothing) e
1032 Nothing -> fmapCheap (const Nothing) e
1037 Just ev -> leftmost [fmapCheap Just ev, fmapCheap (const Nothing) e]
1033 Just ev -> leftmost [fmapCheap Just ev, fmapCheap (const Nothing) e]
1039-- | See 'coincidencePatchMap'
1035-- | See 'coincidencePatchMap'
1040coincidencePatchIntMap :: Reflex t => Event t (PatchIntMap (Event t v)) -> Event t (PatchIntMap v)
1036coincidencePatchIntMap :: Reflex t => Event t (PatchIntMap (Event t v)) -> Event t (PatchIntMap v)
1041−coincidencePatchIntMap e = fmapCheap PatchIntMap $ coincidence $ ffor e $ \(PatchIntMap m) -> mergeIntMap $ ffor m $ \case
1037+coincidencePatchIntMap e = fmapCheap PatchIntMap $ coincidence $ fforCheap e $ \(PatchIntMap m) -> mergeIntMap $ ffor m $ \case
1042 Nothing -> fmapCheap (const Nothing) e
1038 Nothing -> fmapCheap (const Nothing) e
1043 Just ev -> leftmost [fmapCheap Just ev, fmapCheap (const Nothing) e]
1039 Just ev -> leftmost [fmapCheap Just ev, fmapCheap (const Nothing) e]
1045-- | See 'coincidencePatchMap'
1041-- | See 'coincidencePatchMap'
1046coincidencePatchMapWithMove :: (Reflex t, Ord k) => Event t (PatchMapWithMove k (Event t v)) -> Event t (PatchMapWithMove k v)
1042coincidencePatchMapWithMove :: (Reflex t, Ord k) => Event t (PatchMapWithMove k (Event t v)) -> Event t (PatchMapWithMove k v)
1047−coincidencePatchMapWithMove e = fmapCheap unsafePatchMapWithMove $ coincidence $ ffor e $ \p -> mergeMap $ ffor (unPatchMapWithMove p) $ \ni -> case PatchMapWithMove._nodeInfo_from ni of
1043+coincidencePatchMapWithMove e = fmapCheap unsafePatchMapWithMove $ coincidence $ fforCheap e $ \p -> mergeMap $ ffor (unPatchMapWithMove p) $ \ni -> case PatchMapWithMove._nodeInfo_from ni of
1048 PatchMapWithMove.From_Delete -> fforCheap e $ \_ ->
1044 PatchMapWithMove.From_Delete -> fforCheap e $ \_ ->
1049 ni { PatchMapWithMove._nodeInfo_from = PatchMapWithMove.From_Delete }
1045 ni { PatchMapWithMove._nodeInfo_from = PatchMapWithMove.From_Delete }
1050 PatchMapWithMove.From_Move k -> fforCheap e $ \_ ->
1046 PatchMapWithMove.From_Move k -> fforCheap e $ \_ ->
@@ -1304,7 +1300,7 @@ accumMaybeMDyn
1304 -> Event t b
1300 -> Event t b
1305 -> m (Dynamic t a)
1301 -> m (Dynamic t a)
1306accumMaybeMDyn f z e = do
1302accumMaybeMDyn f z e = do
1307− rec let e' = flip push e $ \o -> do
1303+ rec let e' = flip pushCheap e $ \o -> do
1308 v <- sample $ current d'
1304 v <- sample $ current d'
1310 d' <- holdDyn z e'
1306 d' <- holdDyn z e'
@@ -1360,8 +1356,8 @@ mapAccumMaybeMDyn f z e = do
1360 return $ case result of
1356 return $ case result of
1361 (Nothing, Nothing) -> Nothing
1357 (Nothing, Nothing) -> Nothing
1362 _ -> Just result
1358 _ -> Just result
1363− d' <- holdDyn z $ mapMaybe fst e'
1359+ d' <- holdDyn z $ fmapMaybeCheap fst e'
1364− return (d', mapMaybe snd e')
1360+ return (d', fmapMaybeCheap snd e')
1366-- | Accumulate a 'Behavior' by folding occurrences of an 'Event'
1362-- | Accumulate a 'Behavior' by folding occurrences of an 'Event'
1367-- with the provided function.
1363-- with the provided function.
@@ -1399,7 +1395,7 @@ accumMaybeB f = accumMaybeMB $ \v o -> return $ f v o
1399{-# INLINE accumMaybeMB #-}
1395{-# INLINE accumMaybeMB #-}
1400accumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a)) -> a -> Event t b -> m (Behavior t a)
1396accumMaybeMB :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe a)) -> a -> Event t b -> m (Behavior t a)
1401accumMaybeMB f z e = do
1397accumMaybeMB f z e = do
1402− rec let e' = flip push e $ \o -> do
1398+ rec let e' = flip pushCheap e $ \o -> do
1403 v <- sample d'
1399 v <- sample d'
1405 d' <- hold z e'
1401 d' <- hold z e'
@@ -1449,8 +1445,8 @@ mapAccumMaybeMB f z e = do
1449 return $ case result of
1445 return $ case result of
1450 (Nothing, Nothing) -> Nothing
1446 (Nothing, Nothing) -> Nothing
1451 _ -> Just result
1447 _ -> Just result
1452− d' <- hold z $ mapMaybe fst e'
1448+ d' <- hold z $ fmapMaybeCheap fst e'
1453− return (d', mapMaybe snd e')
1449+ return (d', fmapMaybeCheap snd e')
1455-- | Accumulate occurrences of an 'Event', producing an output occurrence each
1451-- | Accumulate occurrences of an 'Event', producing an output occurrence each
1456-- time. Discard the underlying 'Accumulator'.
1452-- time. Discard the underlying 'Accumulator'.
@@ -1676,7 +1672,14 @@ mergeWithFoldCheap' f es =
1676-- | See 'switchHoldPromptly'
1672-- | See 'switchHoldPromptly'
1677switchPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
1673switchPromptly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
1678switchPromptly = switchHoldPromptly
1674switchPromptly = switchHoldPromptly
1679{-# DEPRECATED switchPromptOnly "Use 'switchHoldPromptOnly' instead. The 'switchHold*' naming convention was chosen because those functions are more closely related to each other than they are to 'switch'. " #-}
1676{-# DEPRECATED switchPromptOnly "Use 'switchHoldPromptOnly' instead. The 'switchHold*' naming convention was chosen because those functions are more closely related to each other than they are to 'switch'. " #-}
1680-- | See 'switchHoldPromptOnly'
1677-- | See 'switchHoldPromptOnly'
1681switchPromptOnly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
1678switchPromptOnly :: (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
1682switchPromptOnly = switchHoldPromptOnly
1679switchPromptOnly = switchHoldPromptOnly
1681+{-# DEPRECATED mergeIntMap "Use 'mergeInt' instead" #-}
1682+-- | Like 'mergeMap' but for 'IntMap'.
1683+mergeIntMap :: Reflex t => IntMap (Event t a) -> Event t (IntMap a)
1684+mergeIntMap = mergeInt