<commit_before>open V1_LWT

let (>>=) = Lwt.bind

module Main (C:CONSOLE) = struct
  let buf = String.create 5000

  let rec echo vch =
    Node.V.read_into vch buf 0 5000 >>= fun nb_read ->
    Node.V.write_from_exactly vch buf 0 nb_read >>= fun () ->
    echo vch

  let start c =
    lwt () = Node.with_vchan Node.Server (Eventchn.init ()) 0 "data/vchan" echo in
    Lwt.return ()

end<commit_msg>Update the test VM to use the flow signature<commit_after>open V1_LWT

let (>>=) = Lwt.bind

let (>>|=) m f = m >>= function
| `Ok x -> f x
| `Eof -> Lwt.fail (Failure "End of file")
| `Error (`Not_connected state) -> Lwt.fail (Failure (Printf.sprintf "Not in a connected state: %s" (Sexplib.Sexp.to_string (Node.V.sexp_of_state state))))

module Main (C:CONSOLE) = struct
  let buf = String.create 5000

  let rec echo vch =
    Node.V.read vch >>|= fun input_line ->
    let line = String.uppercase (Cstruct.to_string input_line) in
    let buf = Cstruct.create (String.length line) in
    Cstruct.blit_from_string line 0 buf 0 (String.length line);
    Node.V.write vch buf >>|= fun () ->
    echo vch

  let start c =
    lwt () = Node.with_vchan Node.Server (Eventchn.init ()) 0 "data/vchan" echo in
    Lwt.return ()

end
{'fraction_non_alphanumeric': 0.13447432762836187, 'fraction_numerical': 0.016299918500407497, 'mean_word_length': 3.1346801346801345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4459258', 'n_tokens_mistral': 481, 'n_tokens_neox': 456, 'n_words': 139}