My own corner of monopam
2
fork

Configure Feed

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

mdx: switch doc-example printers from Format/Printf to Fmt

Repo convention is to use the `fmt` library's Fmt.pr / Fmt.epr / etc.
in code, and the recently added mdx examples drifted to
Format.eprintf / Printf.eprintf out of habit. Brought them back into
line so a reader copy-pasting the example doesn't pick up the
wrong style.

Touches the {[ ... ]} blocks in:
- ocaml-collision/lib/collision.mli
- ocaml-cose/lib/cose.mli
- ocaml-delegation/lib/delegation.mli
- ocaml-gdocs/lib/gdocs.mli (also added fmt to the mdx libraries)
- ocaml-runc/lib/runc.mli (also added fmt to the mdx libraries; \n
format escapes became @. for consistency)
- ocaml-sigstore/lib/sigstore.mli

+14 -14
+1 -1
ocaml-collision/lib/collision.mli
··· 6 6 (* Assess a CDM and report the conjunction risk. *) 7 7 let report (cdm : Cdm.t) = 8 8 let a = Collision.assess cdm in 9 - Format.printf "Pc = %e, miss = %.0f m, risk = %a@." a.pc a.miss_distance 9 + Fmt.pr "Pc = %e, miss = %.0f m, risk = %a@." a.pc a.miss_distance 10 10 Collision.pp_risk (Collision.risk_level a) 11 11 ]} 12 12
+2 -2
ocaml-cose/lib/cose.mli
··· 21 21 Cose.Sign1.sign ~protected_header ~payload:"hello world" 22 22 ~key:(`P256 priv) () 23 23 with 24 - | Error e -> Format.eprintf "Sign failed: %a@." Cose.pp_error e 24 + | Error e -> Fmt.epr "Sign failed: %a@." Cose.pp_error e 25 25 | Ok sign1 -> ( 26 26 (* Verify. *) 27 27 match Cose.Sign1.verify ~key:(`P256 pub) sign1 with 28 28 | Ok payload -> assert (payload = "hello world") 29 - | Error e -> Format.eprintf "Verify failed: %a@." Cose.pp_error e) 29 + | Error e -> Fmt.epr "Verify failed: %a@." Cose.pp_error e) 30 30 ]} 31 31 32 32 {2 References}
+3 -3
ocaml-delegation/lib/delegation.mli
··· 35 35 let report (chain : X509.Certificate.t list) = 36 36 match Delegation.Extract.v chain with 37 37 | Ok delegation -> 38 - Format.printf "App: %a@." Delegation.Name.pp delegation.name; 39 - Format.printf "Policies: %d levels@." 38 + Fmt.pr "App: %a@." Delegation.Name.pp delegation.name; 39 + Fmt.pr "Policies: %d levels@." 40 40 (List.length delegation.policies) 41 - | Error e -> Format.printf "Error: %a@." Delegation.Extract.pp_error e 41 + | Error e -> Fmt.pr "Error: %a@." Delegation.Extract.pp_error e 42 42 ]} 43 43 44 44 {1 Modules} *)
+1 -1
ocaml-gdocs/lib/dune
··· 17 17 18 18 (mdx 19 19 (files gdocs.mli) 20 - (libraries gdocs gauth requests eio eio.core eio.unix eio_main)) 20 + (libraries gdocs gauth requests fmt eio eio.core eio.unix eio_main))
+1 -1
ocaml-gdocs/lib/gdocs.mli
··· 16 16 Eio.Switch.run @@ fun sw -> 17 17 let http = Requests.v ~sw env in 18 18 match Gdocs.get http ~token doc_id with 19 - | Error (`Msg e) -> Format.eprintf "fetch failed: %s@." e 19 + | Error (`Msg e) -> Fmt.epr "fetch failed: %s@." e 20 20 | Ok doc -> 21 21 print_endline (Gdocs.Document.title doc); 22 22 print_endline (Gdocs.Markdown.of_document doc)
+1 -1
ocaml-runc/lib/dune
··· 5 5 6 6 (mdx 7 7 (files runc.mli) 8 - (libraries runc eio eio.unix eio_main)) 8 + (libraries runc fmt eio eio.unix eio_main))
+2 -2
ocaml-runc/lib/runc.mli
··· 20 20 let root = Runc.Root.v "rootfs" in 21 21 let config = Runc.Config.v ~process ~root () in 22 22 let json = Runc.Config.to_json config in 23 - Printf.printf "config: %s\n" json; 23 + Fmt.pr "config: %s@." json; 24 24 (* Write json to bundle/config.json, then: *) 25 25 let container = Runc.Command.run ~id:"test" ~bundle:"./bundle" runc in 26 26 match Runc.Command.delete runc container with 27 27 | Ok () -> () 28 - | Error e -> Printf.eprintf "delete failed: %s\n" e 28 + | Error e -> Fmt.epr "delete failed: %s@." e 29 29 ]} *) 30 30 31 31 (** {1 OCI Runtime Specification Types} *)
+3 -3
ocaml-sigstore/lib/sigstore.mli
··· 29 29 Sigstore.sign session ~now ~id_token 30 30 ~artifact:(Sigstore.Artifact.of_string "hello world") 31 31 with 32 - | Error e -> Format.eprintf "Signing failed: %a@." Sigstore.pp_error e 32 + | Error e -> Fmt.epr "Signing failed: %a@." Sigstore.pp_error e 33 33 | Ok bundle -> ( 34 34 (* Verify *) 35 35 match Sigstore.verify session ~now bundle with 36 - | Ok identity -> Format.printf "Signed by %s@." identity.email 36 + | Ok identity -> Fmt.pr "Signed by %s@." identity.email 37 37 | Error e -> 38 - Format.eprintf "Verification failed: %a@." Sigstore.pp_error e) 38 + Fmt.epr "Verification failed: %a@." Sigstore.pp_error e) 39 39 ]} *) 40 40 41 41 (** {1 Hash Algorithms}