Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-yaml: collapse Stream sub-module — IO is always a stream

YAML's grammar admits multi-document streams (1.2.2 §6.2.2 / §9.2)
but most callers parse a single config file. We were modelling that
split with a separate [Yaml.Stream] module: streaming verbs returned
['a list], top-level verbs returned ['a]. Two ways to do the same
thing, with no semantic gain — every doc passes through the same
event pipeline either way.

Drop [Yaml.Stream]. The top-level [of_string]/[of_reader]/
[to_string]/[to_writer] now handle YAML byte streams directly and
take/return ['a list]. Single-doc inputs come back as a one-element
list; the encoder fast-paths a singleton through without a [---]
prologue, so existing single-doc output is byte-identical.

Update the four downstream callers (bottler, ocaml-agent,
ocaml-scaleway, irmin) to wrap each call site with an explicit
single-doc unwrap. The wrappers are local — no shared back-compat
shim — to keep the stream nature of the API visible at every use.

Test: drop "" from the spec-ch10 null-forms case (an empty stream
is zero documents, not an implicit null) and add an explicit
empty-stream assertion citing the relevant spec sections.

+4 -4
+4 -4
lib/yaml/irmin_yaml.ml
··· 3 3 module S = Irmin.SHA256 4 4 5 5 (* Round-trip a YAML scalar through string form. *) 6 - let enc v = Yaml.encode_string Yaml.Codec.value v 6 + let enc v = Yaml.to_string Yaml.Codec.value [ v ] 7 7 8 8 let dec s = 9 - match Yaml.decode_string Yaml.Codec.value s with 10 - | Ok v -> v 11 - | Error _ -> Yaml.Value.null () 9 + match Yaml.of_string Yaml.Codec.value s with 10 + | Ok [ v ] -> v 11 + | Ok _ | Error _ -> Yaml.Value.null () 12 12 13 13 let string_keyed_entries = function 14 14 | Yaml.Mapping (kvs, _) ->