@@ -183,11 +183,7 @@ sequenceIntMapWithAdjustEventWriterTWith base patchNewElements mergePatchIncreme
183 requests' :: Event t (p (Event t w))
183 requests' :: Event t (p (Event t w))
184 requests' = fmapCheap (fmap fst) children'
184 requests' = fmapCheap (fmap fst) children'
185 childRequestMap :: Incremental t (p (Event t w)) <- holdIncremental requests0 requests'
185 childRequestMap :: Incremental t (p (Event t w)) <- holdIncremental requests0 requests'
186− -- We add these two separately to take advantage of the free merge being done later. The coincidence case must come first so that it has precedence if both fire simultaneously. (Really, we should probably block the 'switch' whenever 'updated' fires, but switchPromptlyDyn has the same issue.)
187− tellEvent $ coincidence $ fforCheap requests' $ \p -> mconcat $ patchNewElements p --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
188− tellEvent $ fforMaybeCheap (mergePatchIncremental childRequestMap) $ \m -> case toList m of
186+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
190− h : t -> Just $ sconcat $ h :| t
191 return (result0, result')
187 return (result0, result')
193-- | Like 'runWithReplaceEventWriterTWith', but for 'sequenceDMapWithAdjust'.
189-- | Like 'runWithReplaceEventWriterTWith', but for 'sequenceDMapWithAdjust'.
@@ -216,12 +212,24 @@ sequenceDMapWithAdjustEventWriterTWith base mapPatch weakenPatchWith patchNewEle
216 requests' :: Event t (p' (Some k) (Event t w))
212 requests' :: Event t (p' (Some k) (Event t w))
217 requests' = fforCheap children' $ weakenPatchWith $ fst . getCompose
213 requests' = fforCheap children' $ weakenPatchWith $ fst . getCompose
218 childRequestMap :: Incremental t (p' (Some k) (Event t w)) <- holdIncremental requests0 requests'
214 childRequestMap :: Incremental t (p' (Some k) (Event t w)) <- holdIncremental requests0 requests'
215+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
216+ return (result0, result')
224+ -> (a -> [Event t w])
227+tellEventsPromptly requests' patchNewElements mergedChildRequestMap = do
219 -- We add these two separately to take advantage of the free merge being done later. The coincidence case must come first so that it has precedence if both fire simultaneously. (Really, we should probably block the 'switch' whenever 'updated' fires, but switchPromptlyDyn has the same issue.)
228 -- We add these two separately to take advantage of the free merge being done later. The coincidence case must come first so that it has precedence if both fire simultaneously. (Really, we should probably block the 'switch' whenever 'updated' fires, but switchPromptlyDyn has the same issue.)
220− tellEvent $ coincidence $ fforCheap requests' $ \p -> mconcat $ patchNewElements p --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
229+ tellEvent $ coincidence $ fmapCheap (mconcat . patchNewElements) requests' --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
221− tellEvent $ fforMaybeCheap (mergePatchIncremental childRequestMap) $ \m -> case toList m of
230+ tellEvent $ fforMaybeCheap mergedChildRequestMap $ \m -> case toList m of
222 [] -> Nothing
231 [] -> Nothing
223 h : t -> Just $ sconcat $ h :| t
232 h : t -> Just $ sconcat $ h :| t
224− return (result0, result')
226instance PerformEvent t m => PerformEvent t (EventWriterT t w m) where
234instance PerformEvent t m => PerformEvent t (EventWriterT t w m) where
227 type Performable (EventWriterT t w m) = Performable m
235 type Performable (EventWriterT t w m) = Performable m