Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
import.ml1 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80module String = struct [@@@ocaml.warning "-3-32"] let lowercase_ascii = StringLabels.lowercase let uppercase_ascii = StringLabels.uppercase let capitalize_ascii = StringLabels.capitalize include String end module Char = struct [@@@ocaml.warning "-3-32"] let uppercase_ascii = Char.uppercase include Char end module List = struct include List let rec filter_map f = function [] -> [] | x :: l -> match f x with None -> filter_map f l | Some y -> y :: filter_map f l let concat_map f l = List.map f l |> List.flatten let map_first f = function | [] -> [] | x :: l -> let y = f ~is_first:true x in y :: List.map (f ~is_first:false) l let init n f = Array.to_list (Array.init n f) let mapi l f = Array.of_list l |> Array.mapi f |> Array.to_list let rec find_map f = function | [] -> None | x :: l -> match f x with None -> find_map f l | Some _ as y -> y (* replace first occurrence, if any *) let rec assoc_update k v = function | (k', _) as x :: l -> if k = k' then (k, v) :: l else x :: assoc_update k v l | [] -> [] let rec insert_sep t ~sep = match t with | [] | [_] -> t | x :: xs -> x :: sep @ (insert_sep xs ~sep) end module Option = struct let map f = function | None -> None | Some s -> Some (f s) let value_exn = function | None -> failwith "Option.value_exn" | Some s -> s end let sprintf = Printf.sprintf let printf = Printf.printf let eprintf = Printf.eprintf let bprintf = Printf.bprintf let fprintf = Printf.fprintf