summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-08-10 20:23:23 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-08-10 20:31:06 +0200
commit8743ed1b3713a764ccb191e83cb006a7c4ac60d4 (patch)
treee74e29eed1c76e024c6567bb413c9c9e30713e9b
parent04b57578655656eb13b3d41c91bd995702c27764 (diff)
Identity: implement sameIdentity using storedRoots
-rw-r--r--src/Erebos/Identity.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Erebos/Identity.hs b/src/Erebos/Identity.hs
index c0af02b..f2094f6 100644
--- a/src/Erebos/Identity.hs
+++ b/src/Erebos/Identity.hs
@@ -377,8 +377,9 @@ updateOwners updates orig@Identity { idOwner_ = Just owner, idUpdates_ = cupdate
updateOwners _ orig@Identity { idOwner_ = Nothing } = orig
sameIdentity :: (Foldable m, Foldable m') => Identity m -> Identity m' -> Bool
-sameIdentity x y = not $ S.null $ S.intersection (refset x) (refset y)
- where refset idt = foldr S.insert (ancestors $ toList $ idDataF idt) (idDataF idt)
+sameIdentity x y = intersectsSorted (roots x) (roots y)
+ where
+ roots idt = uniq $ sort $ concatMap storedRoots $ toList $ idDataF idt
unfoldOwners :: (Foldable m) => Identity m -> [ComposedIdentity]