package ppx_repr
PPX deriver for type representations
Install
Dune Dependency
Authors
Maintainers
Sources
repr-fuzz-0.3.0.tbz
sha256=d9bd2fe51c2eb6fca27731034c46f9a77dc8bc9fb7b76216f8a571603d6e7d74
sha512=7b4ad2cbcd92f6647a1abe1d82557f02e4955c5f37f02089388c752e23b865af0f55fdd6bc63a1d2a00962baf96ccd99ccd9b8ecd8898dcc2a0cd17302f067c3
doc/src/ppx_repr.lib/utils.ml.html
Source file 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
open Ppxlib let ( >> ) f g x = g (f x) let ( >|= ) x f = List.map f x module Option = struct include Option let to_bool : unit option -> bool = function Some () -> true | None -> false end module List = struct include List let reduce ~f = function | [] -> None | [ x ] -> Some x | _ :: _ :: _ as l -> let rec aux = function | [] -> assert false | [ a; b ] -> f a b | x :: xs -> f x (aux xs) in Some (aux l) let reduce_exn ~f l = match reduce ~f l with | Some x -> x | None -> failwith "Cannot reduce empty list" end module Make (A : Ast_builder.S) : sig val compose_all : ('a -> 'a) list -> 'a -> 'a (** Left-to-right composition of a list of functions. *) val lambda : string list -> expression -> expression (** [lambda \[ "x_1"; ...; "x_n" \] e] is [fun x1 ... x_n -> e] *) val arrow : core_type list -> core_type -> core_type (** [arrow \[ "t_1"; ...; "t_n" \] u] is [t_1 -> ... -> t_n -> u] *) end = struct open A let compose_all l x = List.fold_left ( |> ) x (List.rev l) let lambda = List.map (pvar >> pexp_fun Nolabel None) >> compose_all let arrow = List.map (ptyp_arrow Nolabel) >> compose_all end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>