@@ -110,10 +110,10 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
110
110
-- If the update is to delete the state for a child that doesn't exist, the patch is mempty.
111
111
Nothing -> return Nothing
112
112
-- 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
114
114
Just oldBs -> case bs of
115
115
-- 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
117
117
-- 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
118
118
-- composed with the sampling the child's new state.
119
119
Just newBs -> maskMempty <$> ((~~) <$> sampleBs newBs <*> sampleBs oldBs)
@@ -154,21 +154,21 @@ instance (Reflex t, MonadFix m, Group q, Additive q, Query q, Eq q, MonadHold t
154
154
-- If the update is to delete the state for a child that doesn't exist, the patch is mempty.
155
155
MapWithMove. From_Delete -> return Nothing
156
156
-- 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
158
158
MapWithMove. From_Move k' -> case Map. lookup k' bs0 of
159
159
Nothing -> return Nothing
160
- Just newBs -> Just <$> sampleBs newBs
160
+ Just newBs -> maskMempty <$> sampleBs newBs
161
161
Just oldBs -> case MapWithMove. _nodeInfo_from bs of
162
162
-- 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
164
164
-- 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
165
165
-- composed with the sampling the child's new state.
166
166
MapWithMove. From_Insert newBs -> maskMempty <$> ((~~) <$> sampleBs newBs <*> sampleBs oldBs)
167
167
MapWithMove. From_Move k'
168
168
| k' == k -> return Nothing
169
169
| otherwise -> case Map. lookup k' bs0 of
170
170
-- 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
172
172
Just newBs -> maskMempty <$> ((~~) <$> sampleBs newBs <*> sampleBs oldBs)
173
173
-- we compute the patch by iterating over the update PatchMap and proceeding by cases. Then we fold over the
174
174
-- child patches and wrap them in AdditivePatch.
0 commit comments