crdt-0.5: Conflict-free replicated data types

Safe HaskellSafe
LanguageHaskell2010

CRDT.PNCounter.Cv

Contents

Synopsis

Documentation

data PNCounter a Source #

Positive-negative counter. Allows incrementing and decrementing. Nice example of combining of existing CvRDT (GCounter in this case) to create another CvRDT.

Instances

Eq a => Eq (PNCounter a) Source # 

Methods

(==) :: PNCounter a -> PNCounter a -> Bool #

(/=) :: PNCounter a -> PNCounter a -> Bool #

Show a => Show (PNCounter a) Source # 
Ord a => Semigroup (PNCounter a) Source # 

Methods

(<>) :: PNCounter a -> PNCounter a -> PNCounter a #

sconcat :: NonEmpty (PNCounter a) -> PNCounter a #

stimes :: Integral b => b -> PNCounter a -> PNCounter a #

Ord a => Semilattice (PNCounter a) Source # 

initial :: PNCounter a Source #

Initial state

query :: Num a => PNCounter a -> a Source #

Get value from the state

Operations

decrement Source #

Arguments

:: Num a 
=> Word

replica id

-> PNCounter a 
-> PNCounter a 

Decrement counter

increment Source #

Arguments

:: Num a 
=> Word

replica id

-> PNCounter a 
-> PNCounter a 

Increment counter