let rprintf fmt =
  Printf.ksprintf
    (fun str -> try return & (output_string stdout str) with | e -> `Error e)
    fmt