1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Compute the key/value pair for inserted elements.

This commit is contained in:
Rob Rix 2015-12-14 19:06:34 -05:00
parent 0d95b54f0f
commit 45ae975496

View File

@ -57,9 +57,11 @@ run comparable (Free (ByKey a b f)) = run comparable $ f byKey where
inserted = (Pure . Insert) <$> Map.difference b a
patched = Map.intersectionWith (interpret comparable) a b
toKeyValue key | Set.member key deleted = (key, Pure $ Delete (a ! key))
toKeyValue key | Set.member key inserted = (key, Pure $ Delete (b ! key))
aKeys = Set.fromList $ Map.keys a
bKeys = Set.fromList $ Map.keys b
deleted = Set.difference aKeys bKeys
inserted = Set.difference bKeys aKeys
run comparable (Free (ByIndex a b f)) = run comparable . f $ ses (constructAndRun comparable) diffCost a b