Monorepo management for opam overlays
0
fork

Configure Feed

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

ocaml-dune: per-module encoding API, abstract types, no Sexp.t leaks

Each file kind (File, Project, Workspace, Package) is now a self-
contained module with abstract t and the standard six-verb IO shape
(of_string / of_string_exn / to_string / of_reader / of_reader_exn /
to_writer). Sexp.t no longer appears in any signature; Dune.Error is
aliased from Sexp.Error.

- Project.t, Workspace.t, File.t made abstract; their old record
exposures (packages : Sexp.t list, env : Sexp.t option, etc.) are
now internal. Round-trip via the codec preserves unrecognized
stanzas.
- Project.Package is a typed view of a (package ...) stanza
(name / synopsis / depends).
- Workspace.Context.kind drops the (Other of Sexp.t) leak; unrecognized
context shapes still round-trip via the codec but are filtered out
of Workspace.contexts.
- File.t internally classifies stanzas (Library / Executable / Test /
Other) so library_names / private_library_names / executable_names /
test_names are typed projections, not Sexp tree walks.
- Dune.Package.libraries reads every (library ...) stanza from a
dune-package file; Sexp.Codec.decode_value stays internal.
- ?indent:int now visibly affects to_string: lists with non-atom
children wrap, single-child and atom-only lists <=4 stay inline.

Drops the old public Sexp-level helpers (parse, to_sexps, per-module
to_string, field / fields / field_atom / field_list / field_atoms /
set_field / remove_field, the library/executable/test builders,
pp_dune, to_string_dune, find_stanza, ...). The functionality lives
internally where each module needs it.

Caller migrations:
- monopam/lib/lint.ml: Dune.File.parse -> Dune.File.of_string.
- ocaml-dune/test/test_dune.ml rewritten against the new API.

README rewritten using the new API; mdx libraries reduces to
(libraries nox-dune) -- no nox-sexp leak.

+4 -3
+4 -3
lib/lint.ml
··· 348 348 |> List.concat_map (fun df -> 349 349 match load_file fs df with 350 350 | None -> [] 351 - | Some content -> 352 - parse_sexps content |> Dune.File.parse 353 - |> Dune.File.private_library_names) 351 + | Some content -> ( 352 + match Dune.File.of_string content with 353 + | Ok t -> Dune.File.private_library_names t 354 + | Stdlib.Error _ -> [])) 354 355 |> String_set.of_list 355 356 356 357 (** Collect all packages referenced via [(libraries ...)] in any dune file in a