From 74deed1259698a5d6b8e31f9287f4e224c99cbc2 Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Sat, 4 Mar 2023 14:25:41 +0100 Subject: [PATCH] Delete the implicit rresult dependency --- .ocamlformat | 2 +- received/received.ml | 9 ++++++--- received/received.mli | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index 9dddcdf..32596ee 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,4 +1,4 @@ -version = 0.23.0 +version = 0.24.1 break-infix = fit-or-vertical parse-docstrings = true indicate-multiline-delimiters=no diff --git a/received/received.ml b/received/received.ml index 516a731..d601d48 100644 --- a/received/received.ml +++ b/received/received.ml @@ -6,6 +6,9 @@ module Option = struct end type 'a stream = unit -> 'a option + +let error_msgf fmt = Format.kasprintf (fun msg -> Error (`Msg msg)) fmt + type protocol = [ `ESMTP | `SMTP | `Atom of string ] (* TODO(dinosaure): according to RFC3848, we should add: @@ -116,7 +119,7 @@ let pp_id ppf = function let pp_for = Path.pp let pp ppf t = - let ptime, tz_offset_s = (Rresult.R.get_ok <.> Date.to_ptime) t.date_time in + let ptime, tz_offset_s = (Result.get_ok <.> Date.to_ptime) t.date_time in Fmt.pf ppf "from: %a@\n\ by: %a@\n\ @@ -402,8 +405,8 @@ let of_stream stream = | Error _err -> go acc else go acc | _ -> go acc) - | `Malformed err -> Rresult.R.error_msg err - | `End rest -> Rresult.R.ok (rest, List.rev acc) + | `Malformed err -> error_msgf "%s" err + | `End rest -> Ok (rest, List.rev acc) | `Await -> let buf, off, len = match stream () with diff --git a/received/received.mli b/received/received.mli index 310f800..759a6aa 100644 --- a/received/received.mli +++ b/received/received.mli @@ -78,4 +78,4 @@ module Encoder : sig end val of_stream : - (string * int * int) stream -> (string * t list, [> Rresult.R.msg ]) result + (string * int * int) stream -> (string * t list, [> `Msg of string ]) result