A PNCounter (or Positive-Negative Counter) is a replicated counter that can be both incremented and decremented.
CRDT.GCounter.Replica
Each replica that modifies the counter is represented by a unique string ID.
PNCounter state
zero : PNCounter
Constructor that creates a new PNCounter with the value zero.
increment : Replica -> PNCounter -> PNCounter
Increment the PNCounter.
decrement : Replica -> PNCounter -> PNCounter
Decrement the PNCounter.
value : PNCounter -> Basics.Int
Get the current value of the PNCounter.
merge : PNCounter -> PNCounter -> PNCounter
Merge two PNCounter states.
Operations that will modify the state of the counter.
apply : Operation -> PNCounter -> PNCounter
Apply an operation on a PNCounter.
patch : List Operation -> PNCounter -> PNCounter
Apply a list of operations (a patch) on a PNCounter.
encode : PNCounter -> Json.Encode.Value
Encode a PNCounter as JSON.
decoder : Json.Decode.Decoder PNCounter
Decode a PNCounter from JSON.