crdt-event-fold 1.8.0.2 → 1.8.1.0
raw patch · 2 files changed
+19/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.CRDT.EventFold: diffSize :: Diff o p e -> Int
Files
- crdt-event-fold.cabal +1/−1
- src/Data/CRDT/EventFold.hs +18/−7
crdt-event-fold.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: crdt-event-fold-version: 1.8.0.2+version: 1.8.1.0 synopsis: Garbage collected event folding CRDT. description: Garbage collected event folding CRDT. Consistently apply arbitrary operations to replicated data.
src/Data/CRDT/EventFold.hs view
@@ -139,6 +139,7 @@ fullMerge_, UpdateResult(..), events,+ diffSize, diffMerge, diffMerge_, MergeError(..),@@ -184,8 +185,8 @@ import Prelude (Applicative(pure), Bool(False, True), Either(Left, Right), Enum(succ), Eq((/=), (==)), Foldable(foldr, maximum), Functor(fmap), Maybe(Just, Nothing), Monoid(mempty), Ord((<), (<=), compare, max),- Semigroup((<>)), ($), (.), (<$>), (||), Num, Show, const, fst, id,- not, otherwise, snd)+ Semigroup((<>)), ($), (.), (<$>), (||), Int, Num, Show, const, fst,+ id, not, otherwise, snd) import Type.Reflection (Typeable) import qualified Data.DoubleWord as DW import qualified Data.Map as Map@@ -590,11 +591,11 @@ {- | A package containing events that can be merged into an event fold. -}-data Diff o p e = Diff {- diffEvents :: Map (EventId p) (Maybe (Delta p e), Set p),- diffOrigin :: o,- diffInfimum :: EventId p,- diffUnjoins :: Set (EventId p)+data Diff o p e = Diff+ { diffEvents :: Map (EventId p) (Maybe (Delta p e), Set p)+ , diffOrigin :: o+ , diffInfimum :: EventId p+ , diffUnjoins :: Set (EventId p) } deriving stock (Generic) deriving stock instance (Eq o, Eq p, Eq e, Eq (Output e)) => Eq (Diff o p e)@@ -608,6 +609,16 @@ Binary o, Binary p, Binary e, Binary (Output e) ) => Binary (Diff o p e)+++{-|+ Return the number of events contained in the diff. This information+ might be useful for optimizing performance by, for instance, choosing to+ use `diffMerge` instead of `fullMerge` when the diff is small or zero.+-}+diffSize :: Diff o p e -> Int+diffSize Diff { diffEvents } =+ Map.size diffEvents {- |