From d58d698e7ce8d6b67715a4592abee364050851a5 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Thu, 29 May 2008 01:16:42 -0500 Subject: [PATCH] diffCollection now works with values --- src/Data/Syncable.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Data/Syncable.hs b/src/Data/Syncable.hs index 97ec0f9..fcafda1 100644 --- a/src/Data/Syncable.hs +++ b/src/Data/Syncable.hs @@ -132,13 +132,15 @@ syncBiDir masterstate childstate lastchildstate = {- | Compares two SyncCollections, and returns the commands that, when applied to the first collection, would yield the second. -} -diffCollection :: (Ord k, Show k, Show v) => +diffCollection :: (Ord k, Show k, Eq v, Show v) => SyncCollection k v -> SyncCollection k v -> [SyncCommand k v] diffCollection coll1 coll2 = (map DeleteItem . findDeleted coll2 coll1 $ coll1) ++ - (map (pairToFunc CopyItem) . findAdded coll2 coll1 $ coll1) + (map (pairToFunc CopyItem) . findAdded coll2 coll1 $ coll1) ++ + (map (pairToFunc ModifyContent) . Map.toList . + findModified coll1 coll2 $ coll1) {- | Returns a list of keys that exist in state2 and lastchildstate but not in state1 -} -- 2.39.2