From 2c297cb6747080cd47cdcd9bbd23c5f24a092e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 13 Apr 2024 08:29:25 +0200 Subject: Chatroom metadata updates --- src/Erebos/Storage/Merge.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Erebos/Storage') diff --git a/src/Erebos/Storage/Merge.hs b/src/Erebos/Storage/Merge.hs index 7234b87..9d9db13 100644 --- a/src/Erebos/Storage/Merge.hs +++ b/src/Erebos/Storage/Merge.hs @@ -10,6 +10,7 @@ module Erebos.Storage.Merge ( generations, ancestors, precedes, + precedesOrEquals, filterAncestors, storedRoots, walkAncestors, @@ -109,6 +110,9 @@ ancestors = last . (S.empty:) . generations precedes :: Storable a => Stored a -> Stored a -> Bool precedes x y = not $ x `elem` filterAncestors [x, y] +precedesOrEquals :: Storable a => Stored a -> Stored a -> Bool +precedesOrEquals x y = filterAncestors [ x, y ] == [ y ] + filterAncestors :: Storable a => [Stored a] -> [Stored a] filterAncestors [x] = [x] filterAncestors xs = let xs' = uniq $ sort xs -- cgit v1.2.3