package core
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Industrial strength alternative to OCaml's standard library
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.17.1.tar.gz
md5=743a141234e04210e295980f7a78a6d9
sha512=61b415f4fb12c78d30649fff1aabe3a475eea926ce6edb7774031f4dc7f37ea51f5d9337ead6ec73cd93da5fd1ed0f2738c210c71ebc8fe9d7f6135a06bd176f
doc/src/core/option.ml.html
Source file option.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 53open! Import include Base.Option type 'a t = 'a option [@@deriving bin_io ~localize, typerep, stable_witness] include Comparator.Derived (struct type nonrec 'a t = 'a t [@@deriving sexp_of, compare] end) let validate ~none ~some t = let module V = Validate in match t with | None -> V.name "none" (V.protect none ()) | Some x -> V.name "some" (V.protect some x) ;; let quickcheck_generator = Base_quickcheck.Generator.option let quickcheck_observer = Base_quickcheck.Observer.option let quickcheck_shrinker = Base_quickcheck.Shrinker.option module Stable = struct module V1 = struct type nonrec 'a t = 'a t [@@deriving bin_io ~localize, compare, equal, hash, sexp, sexp_grammar, stable_witness] end end module Optional_syntax = struct module Optional_syntax = struct let is_none = is_none (* [unsafe_value] is only safe to call when [is_none] returns [false]. To avoid repeating the [is_none] check, we declare [Unchecked_some]. [Unchecked_some x] has the same representation as [Some x], but the type has no [None] clause. We make sure all this works with tests of [unsafe_value] in test_option.ml. We tried using [Obj.field] instead. It generates much worse native code due to float array representations. *) module Unchecked_some = struct (* Warning 37 tells us [Unchecked_some] is never used as a constructor. This is intentional, so we disable the warning. *) type 'a t = Unchecked_some of 'a [@@ocaml.boxed] [@@ocaml.warning "-37"] end let unsafe_value (type a) (t : a t) : a = let (Unchecked_some value) = (Obj.magic t : a Unchecked_some.t) in value ;; end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>