We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64b788b commit cc1598dCopy full SHA for cc1598d
src/compat.ml
@@ -2,15 +2,15 @@ module Option = struct
2
type 'a t = 'a option = None | Some of 'a
3
4
let is_some = function None -> false | Some _ -> true
5
-
6
- let value_exn = function
7
- | None -> failwith "Option.value_exn None"
8
- | Some x -> x
9
10
let value ~default = function None -> default | Some x -> x
11
12
let join_list l =
13
- if List.for_all is_some l then Some (List.map value_exn l) else None
+ let rec loop acc = function
+ | [] -> Some (List.rev acc)
+ | Some a :: q -> loop (a :: acc) q
+ | None :: _ -> None
+ in
+ loop [] l
14
end
15
16
module Char = struct
0 commit comments