To focus the search input from anywhere on the page, press the 'S' key.
in-package search v0.1.0
package async
-
async
-
-
async.lock_file_async
-
async.log_extended
-
async.unpack_sequence
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
type nonrec 'a t = 'a -> unit Async_kernel.Deferred.t
module type S = sig ... end
module type S1 = sig ... end
module type S2 = sig ... end
module type S3 = sig ... end
val invariant :
Core_kernel.Source_code_position.t ->
'a ->
('a -> Core_kernel.Sexp.t) ->
(unit -> unit Async_kernel.Deferred.t) ->
unit Async_kernel.Deferred.t
val check_field :
'a ->
'b t ->
unit Async_kernel.Deferred.t ->
('a, 'b) Core_kernel.Field.t ->
unit Async_kernel.Deferred.t
check_field
can be used to check record fields when using [@@deriving fields]
. Idiomatic usage looks like:
type t = { foo : Foo.t ; bar : Bar.t }
[@@deriving fields]
let invariant t =
Invariant.Async.invariant [%here] t [%sexp_of: t] (fun () ->
let check inv = Invariant.Async.check_field t inv in
Fields.fold ~init:(return ())
~foo: (check Foo.invariant)
~bar: (check Bar.invariant)
When some fields have synchronous invariants, or do not need to be checked, it may be useful to define a second wrapper around check_field
:
type t = { foo : Foo.t ; bar : Bar.t ; quux : Quux.t }
[@@deriving fields]
let invariant t =
Invariant.Async.invariant [%here] t [%sexp_of: t] (fun () ->
let check' inv = Invariant.Async.check_field t inv in
let check inv = check' (fun x -> inv x; return ()) in
Fields.fold ~init:(return ())
~foo: (check' Foo.invariant)
~bar: (check Bar.invariant)
~quux: (check ignore)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>