[go: up one dir, main page]

Shadow stdlib with lwtreslib

Part 4 of !1872 (closed)

  • It introduces a few compatibility modules for the protocol environment (using structs/) so that the old protocol continues to use the legacy modules.
  • It shadows Seq, Set, Map, and Hashtbl (using Lwtreslib within lib_crypto, and using Base's TzPervasives for the rest). Because TzPervasives is opened widely (as a dune rule) this shadowing is widespread.
  • It then changes all the rest of the code to use the new shadowing modules. The main change is to call find directly (instead of find_opt). Some more changes:
    • use find which returns an option rather than relying on Not_found for control flow,
    • use the {iter,fold,etc.}_{e,s,es,p,ep} directly rather than going through an intermediate list or folding over a promise

The shadows are safe(r) versions (not raising exceptions) of existing modules and they provide traversors that are Lwt- and Error- aware. This makes for a safe, homogeneous coding experience over all the collections we use.

Edited by Raphaël Proust

Merge request reports

Loading