crdt 2.0 → 2.1
raw patch · 5 files changed
+14/−12 lines, 5 filesdep −QuickCheckdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: QuickCheck
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- crdt.cabal +3/−4
- lib/CRDT/Cv/GCounter.hs +3/−3
- lib/CRDT/Cv/PNCounter.hs +3/−2
- lib/CRDT/LWW.hs +3/−2
- test/ArbitraryOrphans.hs +2/−1
crdt.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: crdt-version: 2.0+version: 2.1 synopsis: Conflict-free replicated data types description: Definitions of CmRDT and CvRDT. Implementations for some classic CRDTs. category: Distributed Systems@@ -24,7 +24,7 @@ hs-source-dirs: lib build-depends:- base >= 4.9 && < 4.10+ base >= 4.9 && < 4.11 , containers , mtl exposed-modules:@@ -48,9 +48,8 @@ hs-source-dirs: test build-depends:- base >= 4.9 && < 4.10+ base >= 4.9 && < 4.11 , containers- , QuickCheck , tasty , tasty-quickcheck , crdt
lib/CRDT/Cv/GCounter.hs view
@@ -9,8 +9,7 @@ import Data.IntMap.Strict (IntMap) import qualified Data.IntMap.Strict as IntMap import Data.Semigroup (Semigroup ((<>)))--import CRDT.Cv (CvRDT)+import Data.Semilattice (Semilattice) -- | Grow-only counter. newtype GCounter a = GCounter (IntMap a)@@ -19,7 +18,8 @@ instance Ord a => Semigroup (GCounter a) where GCounter x <> GCounter y = GCounter $ IntMap.unionWith max x y -instance Ord a => CvRDT (GCounter a)+-- | See 'CvRDT'+instance Ord a => Semilattice (GCounter a) -- | Increment counter increment
lib/CRDT/Cv/PNCounter.hs view
@@ -10,8 +10,8 @@ ) where import Data.Semigroup (Semigroup (..))+import Data.Semilattice (Semilattice) -import CRDT.Cv (CvRDT) import CRDT.Cv.GCounter (GCounter) import qualified CRDT.Cv.GCounter as GCounter @@ -29,7 +29,8 @@ instance Ord a => Semigroup (PNCounter a) where PNCounter p1 n1 <> PNCounter p2 n2 = PNCounter (p1 <> p2) (n1 <> n2) -instance Ord a => CvRDT (PNCounter a)+-- | See 'CvRDT'+instance Ord a => Semilattice (PNCounter a) -- | Get value from the state query :: Num a => PNCounter a -> a
lib/CRDT/LWW.hs view
@@ -14,9 +14,9 @@ import Data.Function (on) import Data.Semigroup (Semigroup, (<>))+import Data.Semilattice (Semilattice) import CRDT.Cm (CausalOrd (..), CmRDT (..))-import CRDT.Cv (CvRDT) import LamportClock (Clock (newTimestamp), Timestamp) -- | Last write wins. Assuming timestamp is unique.@@ -40,7 +40,8 @@ instance Semigroup (LWW a) where (<>) = max -instance CvRDT (LWW a)+-- | See 'CvRDT'+instance Semilattice (LWW a) -- | Initialize state initial :: Clock f => a -> f (LWW a)
test/ArbitraryOrphans.hs view
@@ -5,7 +5,8 @@ module ArbitraryOrphans () where -import Test.QuickCheck (Arbitrary (..), arbitraryBoundedEnum, oneof)+import Test.Tasty.QuickCheck (Arbitrary (..), arbitraryBoundedEnum,+ oneof) import CRDT.Cm.Counter (Counter (..)) import CRDT.Cm.GSet (GSet (..))