Skip to content

Commit

Permalink
Delete the implicit rresult dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosaure committed Mar 5, 2023
1 parent f3a30b4 commit 74deed1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 0.23.0
version = 0.24.1
break-infix = fit-or-vertical
parse-docstrings = true
indicate-multiline-delimiters=no
Expand Down
9 changes: 6 additions & 3 deletions received/received.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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\
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion received/received.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 74deed1

Please sign in to comment.