My own corner of monopam
2
fork

Configure Feed

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

ocaml-zephyr: rewrite README example to typecheck

The block had stray newlines breaking [let writer = ...] /
[let reader = ...] across lines, missing [in], a top-level [match]
expression, and [print_endline] mixing. Wrap as [send () = ...] /
[recv () = ...] with [Fmt.pr], and add [fmt] to the mdx libraries.

+12 -15
+11 -14
ocaml-zephyr/README.md
··· 36 36 ## Usage 37 37 38 38 ```ocaml 39 - (* Wait for a port and exchange data *) 40 - let () = 41 - if Zephyr.Virtio_port.wait "ipc" ~timeout:5.0 then begin 42 - 43 - let writer = Zephyr.Virtio_port.open_write "ipc" Zephyr.Virtio_port.write_all writer "hello from partition 0"; 44 - Zephyr.Virtio_port.close writer 45 - end 39 + (* Wait for a port and exchange data. *) 40 + let send () = 41 + if Zephyr.Virtio_port.wait "ipc" ~timeout:5.0 then ( 42 + let writer = Zephyr.Virtio_port.open_write "ipc" in 43 + Zephyr.Virtio_port.write_all writer "hello from partition 0"; 44 + Zephyr.Virtio_port.close writer) 46 45 47 - let () = 48 - 49 - let reader = Zephyr.Virtio_port.open_read "ipc" 50 - match Zephyr.Virtio_port.read_exact reader 21 with 51 - | Some data -> print_endline data 52 - | None -> print_endline "EOF" 53 - ; 46 + let recv () = 47 + let reader = Zephyr.Virtio_port.open_read "ipc" in 48 + (match Zephyr.Virtio_port.read_exact reader 21 with 49 + | Some data -> Fmt.pr "%s@." data 50 + | None -> Fmt.pr "EOF@."); 54 51 Zephyr.Virtio_port.close reader 55 52 ``` 56 53
+1 -1
ocaml-zephyr/dune
··· 4 4 5 5 (mdx 6 6 (files README.md) 7 - (libraries zephyr)) 7 + (libraries zephyr fmt))