You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocaml-csexp/SOURCES/ocaml-csexp-result.patch

93 lines
3.3 KiB

--- 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
@@ -15,12 +15,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
@@ -283,9 +277,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
@@ -33,24 +33,24 @@ module Make (Sexp : Sexp) : 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.t, int * string) Result.t
+ val parse_string : string -> (Sexp.t, int * string) result
(** [parse_string s] parses a sequence of S-expressions encoded in canonical
form in [s] *)
- val parse_string_many : string -> (Sexp.t list, int * string) Result.t
+ val parse_string_many : string -> (Sexp.t 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.t, string) Result.t
+ val input : in_channel -> (Sexp.t, 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.t option, string) Result.t
+ val input_opt : in_channel -> (Sexp.t option, string) result
(** Read many S-expressions until the end of input is reached. *)
- val input_many : in_channel -> (Sexp.t list, string) Result.t
+ val input_many : in_channel -> (Sexp.t list, string) result
(** {2 Serialising} *)
@@ -352,18 +352,18 @@ module Make (Sexp : Sexp) : 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.t, string) Result.t Input.Monad.t
+ val parse : Input.t -> (Sexp.t, string) result Input.Monad.t
- val parse_many : Input.t -> (Sexp.t list, string) Result.t Input.Monad.t
+ val parse_many : Input.t -> (Sexp.t list, string) result Input.Monad.t
end
[@@deprecated "Use Parser module instead"]
end