package core_kernel
Industrial strength alternative to OCaml's standard library
Install
Dune Dependency
Authors
Maintainers
Sources
core_kernel-v0.15.0.tar.gz
sha256=34a0288f16027c6b90e4ad16cb5cc677d7063d310faf918748ce70f1745116c0
doc/src/core_kernel.uopt/uopt.ml.html
Source file uopt.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
open Core type +'a t (* This [Obj.magic] is OK because we never allow user code access to [none] (except via [unsafe_value]). We disallow [_ Uopt.t Uopt.t], so there is no chance of confusing [none] with [some none]. And [float Uopt.t array] is similarly disallowed. *) let none : 'a t = Obj.magic "Uopt.none" let some (x : 'a) : 'a t = Obj.magic x let unsafe_value (x : 'a t) : 'a = Obj.magic x let is_none t = phys_equal t none let is_some t = not (is_none t) let invariant invariant_a t = if is_some t then invariant_a (unsafe_value t) let sexp_of_t sexp_of_a t = if is_none t then [%sexp None] else [%sexp Some (unsafe_value t : a)] ;; let value_exn t = if is_none t then failwith "Uopt.value_exn" else unsafe_value t let to_option t = if is_none t then None else Some (unsafe_value t) let of_option = function | None -> none | Some a -> some a ;; module Optional_syntax = struct module Optional_syntax = struct let is_none = is_none let unsafe_value = unsafe_value end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>