Commit 260e64e
irmin-lwt: expose Make's output as a named module type S
Extract the Lwt-flavoured signature produced by [Make] into a top-level
[module type S] and have [Make] return a module conforming to it with
explicit type and module equalities. This is the architectural piece
needed by Tezos' [Tezos_context_helpers.Context.DB]:
module type DB = Irmin.Generic_key.S with module Schema = Schema
stops type-checking against [Irmin_lwt.Make(S)]'s result because the
latter's [Repo.v] returns [t Lwt.t] instead of [t]. With this change,
downstream consumers can now write
module type DB = Irmin_lwt.S with module Schema = Schema
and type contents = value
and ...
and pass an [Irmin_lwt.Make(_)] module as [DB].
The [module type S] body is mirrored between [.ml] and [.mli] (both are
required — OCaml demands the module type declaration in both); the rest
of the implementation is unchanged. Tree's lazy [Contents] submodule is
re-exposed, and the store-level [Contents] is wrapped with
Lwt-returning [of_key]/[of_hash] to match the signature.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 2b21308 commit 260e64e
2 files changed
Lines changed: 882 additions & 207 deletions
0 commit comments