ORSet
An observed-remove (add-wins) set of E. Concurrent add and remove of the same element resolve in favour of the add: a remove only cancels the adds it has actually witnessed (the Dots currently on the element), so an add the remover never saw survives. This is the usable form of the dots + causal context machinery — e.g. a presence set of who is currently online.
Built as a thin wrapper over Causal<DotMap<E, DotSet>>: each element key maps to the set of dots that added it; it is present iff that set is non-empty.
Immutable: add/remove return a new set. piece is the causal merge.
Samples
val a = ReplicaId("A")
val b = ReplicaId("B")
// Shared start: "alice" is present on both replicas.
val start = ORSet.empty<String>().add(a, "alice")
val alice = start.remove("alice") // Alice concurrently removes
val bob = start.add(b, "alice") // Bob concurrently re-adds
val merged = alice.piece(bob)
check(merged.contains("alice")) // add-winsContent copied to clipboard