ocaml-csexp/ocaml-csexp-result.patch

93 lines
3.2 KiB
Diff

--- a/csexp.opam
+++ b/csexp.opam
@@ -32,7 +32,6 @@ bug-reports: "https://github.com/ocaml-d
depends: [
"dune" {>= "1.11"}
"ocaml" {>= "4.02.3"}
- "result" {>= "1.5"}
]
dev-repo: "git+https://github.com/ocaml-dune/csexp.git"
build: [
--- a/src/csexp.ml
+++ b/src/csexp.ml
@@ -102,12 +102,6 @@ end
module Make (Sexp : Sexp) = struct
open Sexp
- (* This is to keep compatibility with 4.02 without writing [Result.]
- everywhere *)
- type ('a, 'b) result = ('a, 'b) Result.result =
- | Ok of 'a
- | Error of 'b
-
module Parser = struct
exception Parse_error of string
@@ -370,9 +364,9 @@ module Make (Sexp : Sexp) = struct
module Monad : Monad
- val read_string : t -> int -> (string, string) Result.t Monad.t
+ val read_string : t -> int -> (string, string) result Monad.t
- val read_char : t -> (char, string) Result.t Monad.t
+ val read_char : t -> (char, string) result Monad.t
end
module Make_parser (Input : Input) = struct
--- a/src/csexp.mli
+++ b/src/csexp.mli
@@ -34,24 +34,24 @@ module type S = sig
[s]. It is an error for [s] to contain a S-expression followed by more
data. In case of error, the offset of the error as well as an error
message is returned. *)
- val parse_string : string -> (sexp, int * string) Result.t
+ val parse_string : string -> (sexp, int * string) result
(** [parse_string s] parses a sequence of S-expressions encoded in canonical
form in [s] *)
- val parse_string_many : string -> (sexp list, int * string) Result.t
+ val parse_string_many : string -> (sexp list, int * string) result
(** Read exactly one canonical S-expressions from the given channel. Note that
this function never raises [End_of_file]. Instead, it returns [Error]. *)
- val input : in_channel -> (sexp, string) Result.t
+ val input : in_channel -> (sexp, string) result
(** Same as [input] but returns [Ok None] if the end of file has already been
reached. If some more characters are available but the end of file is
reached before reading a complete S-expression, this function returns
[Error]. *)
- val input_opt : in_channel -> (sexp option, string) Result.t
+ val input_opt : in_channel -> (sexp option, string) result
(** Read many S-expressions until the end of input is reached. *)
- val input_many : in_channel -> (sexp list, string) Result.t
+ val input_many : in_channel -> (sexp list, string) result
(** {2 Serialising} *)
@@ -353,18 +353,18 @@ module type S = sig
val bind : 'a t -> ('a -> 'b t) -> 'b t
end
- val read_string : t -> int -> (string, string) Result.t Monad.t
+ val read_string : t -> int -> (string, string) result Monad.t
- val read_char : t -> (char, string) Result.t Monad.t
+ val read_char : t -> (char, string) result Monad.t
end
[@@deprecated "Use Parser module instead"]
[@@@warning "-3"]
module Make_parser (Input : Input) : sig
- val parse : Input.t -> (sexp, string) Result.t Input.Monad.t
+ val parse : Input.t -> (sexp, string) result Input.Monad.t
- val parse_many : Input.t -> (sexp list, string) Result.t Input.Monad.t
+ val parse_many : Input.t -> (sexp list, string) result Input.Monad.t
end
[@@deprecated "Use Parser module instead"]
end