this repo has no description
1module Option = struct
2 type 'a t = 'a option = None | Some of 'a
3
4 let is_some = function None -> false | Some _ -> true
5 let value ~default = function None -> default | Some x -> x
6
7 let join_list l =
8 let rec loop acc = function
9 | [] -> Some (List.rev acc)
10 | Some a :: q -> loop (a :: acc) q
11 | None :: _ -> None
12 in
13 loop [] l
14end
15
16module Char = struct
17 include Char
18
19 let equal (x : char) y = x = y
20end
21
22module String = struct
23 include String
24
25 let for_all f str =
26 let rec aux i =
27 if i >= String.length str then true
28 else if f (String.get str i) then aux (i + 1)
29 else false
30 in
31 aux 0
32end