package ppx_deriving_yojson
JSON codec generator for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
ppx_deriving_yojson-3.10.0.tbz
sha256=ced3d265e4287f1f18b09df6446a24444fad52b2a3054cbcbe0c9494d0e89b3f
sha512=038752a73690dc1b55031c119f57ee27fbee0d51a4a541d2f31ad1baf8b05637396c0b97a7dbfd77db600b689e90a62bfff7ca3fcf74545bd5b32dc3dabff511
doc/src/ppx_deriving_yojson.runtime/ppx_deriving_yojson_runtime.ml.html
Source file ppx_deriving_yojson_runtime.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
include Ppx_deriving_runtime let (>>=) x f = match x with Ok x -> f x | (Error _) as x -> x let (>|=) x f = x >>= fun x -> Ok (f x) let rec map_bind f acc xs = match xs with | x :: xs -> (* equivalent to [f x >>= fun x -> map_bind f (x :: acc) xs], but do not use [(>>=)] to keep [map_bind] tail-recursive under js-of-ocaml *) (match f x with | ((Error _) as err) -> err | Ok x -> map_bind f (x :: acc) xs) | [] -> Ok (List.rev acc) type 'a error_or = ('a, string) result (** [safe_map f l] returns the same value as [List.map f l], but computes it tail-recursively so that large list lengths don't cause a stack overflow *) let safe_map f l = List.rev (List.rev_map f l)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>