package odoc
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml Documentation Generator
Install
dune-project
Dependency
Authors
Maintainers
Sources
odoc-3.2.1.tbz
sha256=d45eb125514839fd9ac27702bb4938d1b4f3b6978e9b16ab9673ea067245affc
sha512=3555386b4770a7caa8ec903683bde5ecdc41d5e57ffaee617d5da225c747bbd1e9c1d2677f4df97e96bbdfc69f580ea83b1b92b933ea40a436a658788b677bbc
doc/src/odoc.odoc_utils/odoc_utils.ml.html
Source file odoc_utils.ml
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 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 76type msg = [ `Msg of string ] (** The [result] type and a bind operator. This module is meant to be opened. *) module ResultMonad = struct let map_error f = function Ok _ as ok -> ok | Error e -> Error (f e) let of_option ~error = function Some x -> Ok x | None -> Error error let ( >>= ) = Result.bind end (** A bind operator for the [option] type. This module is meant to be opened. *) module OptionMonad = struct (* The error case become [None], the error value is ignored. *) let of_result = function Ok x -> Some x | Error _ -> None let ( >>= ) = Option.bind end module List = Odoc_list module Tree = Tree module Forest = Tree.Forest module Json = Json module Io_utils = struct (** [with_open_*] are resource safe wrappers around opening and closing channels. They are equivalent to the same functions in OCaml 4.14's [In_channel] and [Out_channel]. *) let _with_resource res ~close f = Fun.protect ~finally:(fun () -> close res) (fun () -> f res) let with_open_in fname f = _with_resource (open_in fname) ~close:close_in_noerr f let with_open_in_bin fname f = _with_resource (open_in_bin fname) ~close:close_in_noerr f (** Read a file line-by-line by folding [f]. *) let fold_lines fname f acc = _with_resource (open_in fname) ~close:close_in_noerr (fun ic -> let rec loop acc = match input_line ic with | exception End_of_file -> acc | line -> loop (f line acc) in loop acc) (** Read a file as a list of lines. *) let read_lines fname = List.rev (fold_lines fname (fun line acc -> line :: acc) []) let with_open_out fname f = _with_resource (open_out fname) ~close:close_out_noerr f let with_open_out_bin fname f = _with_resource (open_out_bin fname) ~close:close_out_noerr f (** Like [with_open_out] but operate on a [Format] buffer. *) let with_formatter_out fname f = with_open_out fname (fun oc -> f (Format.formatter_of_out_channel oc)) (** Shortcuts for composing [with_open_*] functions and [Marshal]. *) let marshal fname v = with_open_out_bin fname (fun oc -> Marshal.to_channel oc v []) let unmarshal fname = with_open_in_bin fname Marshal.from_channel end module Int = struct include Int let max x y : t = if x >= y then x else y end include Astring
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>