1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
open! Import
module Result = Base.Result
module Stable = struct
module V1 = struct
type ('a, 'b) t = ('a, 'b) Result.t =
| Ok of 'a
| Error of 'b
[@@deriving
bin_io ~localize
, compare
, diff
, equal
, globalize
, hash
, sexp
, sexp_grammar
, stable_witness
, typerep]
let map x ~f1 ~f2 =
match x with
| Error err -> Error (f2 err)
| Ok x -> Ok (f1 x)
;;
end
module V1_stable_unit_test = struct
type t = (string, int) V1.t [@@deriving bin_io, compare, equal, hash, sexp]
let tests =
[ V1.Ok "foo", "(Ok foo)", "\000\003foo"; V1.Error 7, "(Error 7)", "\001\007" ]
;;
end
end
include Stable.V1
include Result