@@ -110,10 +110,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
110110 -- If the update is to delete the state for a child that doesn't exist, the patch is mempty.
111111 Nothing -> return Nothing
112112 -- If the update is to update the state for a child that doesn't exist, the patch is the sample of the new state.
113− Just newBs -> Just <$> sampleBs newBs
113+ Just newBs -> maskMempty <$> sampleBs newBs
114114 Just oldBs -> case bs of
115115 -- If the update is to delete the state for a child that already exists, the patch is the negation of the child's current state
116− Nothing -> Just . negateG <$> sampleBs oldBs
116+ Nothing -> maskMempty . negateG <$> sampleBs oldBs
117117 -- If the update is to update the state for a child that already exists, the patch is the negation of sampling the child's current state
118118 -- composed with the sampling the child's new state.
119119 Just newBs -> maskMempty <$> ((~~) <$> sampleBs newBs <*> sampleBs oldBs)
@@ -154,13 +154,13 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
154154 -- If the update is to delete the state for a child that doesn't exist, the patch is mempty.
155155 MapWithMove.From_Delete -> return Nothing
156156 -- If the update is to update the state for a child that doesn't exist, the patch is the sample of the new state.
157− MapWithMove.From_Insert newBs -> Just <$> sampleBs newBs
157+ MapWithMove.From_Insert newBs -> maskMempty <$> sampleBs newBs
158158 MapWithMove.From_Move k' -> case Map.lookup k' bs0 of
159159 Nothing -> return Nothing
160− Just newBs -> Just <$> sampleBs newBs
160+ Just newBs -> maskMempty <$> sampleBs newBs
161161 Just oldBs -> case MapWithMove._nodeInfo_from bs of
162162 -- If the update is to delete the state for a child that already exists, the patch is the negation of the child's current state
163− MapWithMove.From_Delete -> Just . negateG <$> sampleBs oldBs
163+ MapWithMove.From_Delete -> maskMempty . negateG <$> sampleBs oldBs
164164 -- If the update is to update the state for a child that already exists, the patch is the negation of sampling the child's current state
165165 -- composed with the sampling the child's new state.
166166 MapWithMove.From_Insert newBs -> maskMempty <$> ((~~) <$> sampleBs newBs <*> sampleBs oldBs)
@@ -168,7 +168,7 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
168168 | k' == k -> return Nothing
169169 | otherwise -> case Map.lookup k' bs0 of
170170 -- If we are moving from a non-existent key, that is a delete
171− Nothing -> Just . negateG <$> sampleBs oldBs
171+ Nothing -> maskMempty . negateG <$> sampleBs oldBs
172172 Just newBs -> maskMempty <$> ((~~) <$> sampleBs newBs <*> sampleBs oldBs)
173173 -- we compute the patch by iterating over the update PatchMap and proceeding by cases. Then we fold over the
174174 -- child patches and wrap them in AdditivePatch.