niho / elm-crdt / CRDT.GSet

A GSet (or Grow-only Set) is a replicated set that can only be added to. Removing elements from the set is not supported.

GSet


type GSet comparable

GSet state.

empty : GSet comparable

Constructor that creates a new empty GSet.

insert : comparable -> GSet comparable -> GSet comparable

Insert a value in the set.

member : comparable -> GSet comparable -> Basics.Bool

Determine if a value is in the set.

merge : GSet comparable -> GSet comparable -> GSet comparable

Merge two GSet states.

fromList : List comparable -> GSet comparable

Convert a list of values into a GSet.

toList : GSet comparable -> List comparable

Convert a GSet to a list of values.

toSet : GSet comparable -> Set comparable

Convert a GSet to a Set.

Operations


type Operation comparable
    = Insert comparable

Operations that will modify the state of the set.

apply : Operation comparable -> GSet comparable -> GSet comparable

Apply an operation on a GSet.

patch : List (Operation comparable) -> GSet comparable -> GSet comparable

Apply a list of operations (a patch) on a GSet.

Serialization

encode : (comparable -> Json.Encode.Value) -> GSet comparable -> Json.Encode.Value

Encode a GSet as JSON.

decoder : Json.Decode.Decoder comparable -> Json.Decode.Decoder (GSet comparable)

Decode a GSet from JSON.