package sherlodoc
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Search engine for OCaml documentation
Install
dune-project
Dependency
Authors
Maintainers
Sources
odoc-3.2.1.tbz
sha256=d45eb125514839fd9ac27702bb4938d1b4f3b6978e9b16ab9673ea067245affc
sha512=3555386b4770a7caa8ec903683bde5ecdc41d5e57ffaee617d5da225c747bbd1e9c1d2677f4df97e96bbdfc69f580ea83b1b92b933ea40a436a658788b677bbc
doc/src/sherlodoc.db/type_polarity.ml.html
Source file type_polarity.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 62open Typexpr module Sign = struct type t = | Pos | Neg let to_string = function | Pos -> "+" | Neg -> "-" let not = function | Pos -> Neg | Neg -> Pos end let rev_concat lst = List.fold_left (fun acc xs -> List.rev_append xs acc) [] lst type t = string * int * Sign.t let poly = "@" let rec of_typ ~any_is_poly ~prefix ~sgn = function | Poly _ -> [ sgn, poly :: prefix ] | Any -> if any_is_poly then [ sgn, poly :: prefix ] else [ sgn, prefix ] | Arrow (a, b) -> List.rev_append (of_typ ~any_is_poly ~prefix ~sgn:(Sign.not sgn) a) (of_typ ~any_is_poly ~prefix ~sgn b) | Constr (name, args) -> begin let prefix = String.lowercase_ascii name :: prefix in match args with | [] -> [ sgn, prefix ] | _ -> rev_concat @@ List.mapi (fun i arg -> let prefix = string_of_int i :: prefix in of_typ ~any_is_poly ~prefix ~sgn arg) args end | Tuple args -> rev_concat @@ List.map (of_typ ~any_is_poly ~prefix ~sgn) @@ args | Unhandled -> [] let regroup lst = let h = Hashtbl.create 16 in List.iter (fun v -> let count = try Hashtbl.find h v with | Not_found -> 0 in Hashtbl.replace h v (count + 1)) lst ; Hashtbl.to_seq h let of_typ ~any_is_poly t = t |> of_typ ~any_is_poly ~prefix:[] ~sgn:Pos |> List.map (fun (polarity, path) -> polarity, String.concat " " (List.rev path)) |> regroup |> Seq.map (fun ((polarity, path), count) -> path, count, polarity)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>