type Content<'t> = | Value of value:'t // cell with a value inside | Tombstone // deleted value | Moved of ID * priority:int // move operation with an ID of moved block type Block<'t> = { Id: ID OriginLeft: Option<ID> OriginRight: Option<ID> MovedTo: Option<ID> // where current block has been moved Value: Content<'t> } module Block = let isDeleted b = match b.Value with Tombstone -> true | _ -> false let value b = match b.Value with Value v -> Some v | _ -> None let move replicaId (src: int) (dst: int) (array: Yata<'t>) : Yata<'t> = // get the left/right neighbours of the move destination let dst = findPosition dst array let seqNr = 1UL + lastSeqNr replicaId array let left = array |> getBlock (dst-1) |> Option.map (fun b -> b.Id) let right = array |> getBlock dst |> Option.map (fun b ->…