niho/elm-crdt/1.0.0

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 -> 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 -> Value) -> GSet comparable -> Value

Encode a GSet as JSON.

decoder : Decoder comparable -> Decoder (GSet comparable)

Decode a GSet from JSON.