lattice_text

Plain-text CRDT for Gleam using YATA-style left/right origins.

Use this package when replicas need to edit shared text concurrently and converge without coordination. All operations are grapheme-based, so emoji and combining sequences count as one unit. For a generic list CRDT, use lattice_sequence directly.

Installation

gleam add lattice_text

Quick example

import lattice_core/replica_id
import lattice_text/text

pub fn main() {
  let node_a =
    text.new(replica_id.new("node-a"))
    |> text.insert(0, "Hello world")

  let node_b =
    text.new(replica_id.new("node-b"))
    |> text.append("!")

  let merged = text.merge(node_a, node_b)

  text.value(merged)
  // -> "Hello world!"
}

Modules

ModulePurpose
lattice_text/textGrapheme-based text CRDT with editing, range, and delta operations.

Notes

Links

License

MIT

Search Document