File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change 1
- (* All modules from [Stdune] should be in the struct below. The modules are
2
- listed alphabetically. Try to keep the order. *)
1
+ (* The modules are listed alphabetically. Try to keep the order. *)
3
2
4
3
include struct
5
4
open Stdune
@@ -53,13 +52,31 @@ module List = struct
53
52
end
54
53
55
54
module Result = struct
56
- module O = Stdune.Result. O
55
+ module O = struct
56
+ let ( let+ ) x f = Result. map f x
57
+ let ( let* ) x f = Result. bind x f
58
+ end
59
+
57
60
include Base. Result
58
61
end
59
62
60
63
module Option = struct
61
- module O = Stdune.Option. O
62
- module List = Stdune.Option. List
64
+ module O = struct
65
+ let ( let+ ) x f = Option. map f x
66
+ let ( let* ) x f = Option. bind x f
67
+ end
68
+
69
+ module List = struct
70
+ let all =
71
+ let rec loop acc = function
72
+ | [] -> Some (List. rev acc)
73
+ | None :: _ -> None
74
+ | Some x :: xs -> loop (x :: acc) xs
75
+ in
76
+ fun xs -> loop [] xs
77
+ ;;
78
+ end
79
+
63
80
include Base. Option
64
81
end
65
82
You can’t perform that action at this time.
0 commit comments