@@ -183,11 +183,7 @@ sequenceIntMapWithAdjustEventWriterTWith base patchNewElements mergePatchIncreme
183183 requests' :: Event t (p (Event t w))
184184 requests' = fmapCheap (fmap fst) children'
185185 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
189− [] -> Nothing
190− h : t -> Just $ sconcat $ h :| t
186+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
191187 return (result0, result')
192188
193189-- | Like 'runWithReplaceEventWriterTWith', but for 'sequenceDMapWithAdjust'.
@@ -216,12 +212,24 @@ sequenceDMapWithAdjustEventWriterTWith base mapPatch weakenPatchWith patchNewEle
216212 requests' :: Event t (p' (Some k) (Event t w))
217213 requests' = fforCheap children' $ weakenPatchWith $ fst . getCompose
218214 childRequestMap :: Incremental t (p' (Some k) (Event t w)) <- holdIncremental requests0 requests'
215+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
216+ return (result0, result')
217+
218+tellEventsPromptly
219+ :: ( Foldable f
220+ , Reflex t
221+ , EventWriter t w m
222+ )
223+ => Event t a
224+ -> (a -> [Event t w])
225+ -> Event t (f w)
226+ -> m ()
227+tellEventsPromptly requests' patchNewElements mergedChildRequestMap = do
219228 -- 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'
221− tellEvent $ fforMaybeCheap (mergePatchIncremental childRequestMap) $ \m -> case toList m of
229+ tellEvent $ coincidence $ fmapCheap (mconcat . patchNewElements) requests' --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
230+ tellEvent $ fforMaybeCheap mergedChildRequestMap $ \m -> case toList m of
222231 [] -> Nothing
223232 h : t -> Just $ sconcat $ h :| t
224− return (result0, result')
225233
226234instance PerformEvent t m => PerformEvent t (EventWriterT t w m) where
227235 type Performable (EventWriterT t w m) = Performable m