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