package core_kernel

  1. Overview
  2. Docs
Industrial strength alternative to OCaml's standard library

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=fd2b8c6715794df7a810a62b226f53720f211cd344b4afc9fab0498796d6b466

doc/core_kernel.bus/Bus/Callback_arity/index.html

Module Bus.Callback_aritySource

Callback_arity states the type of callbacks stored in a bus. Using Callback_arity is an implementation technique that allows callbacks to be defined as ordinary n-ary curried functions (e.g., a1 -> a2 -> a3 -> r), instead of forcing n-ary-variadic callbacks to use tuples (e.g., a1 * a2 * a3 -> r). This also avoids extra allocation.

When reading the bus interface, keep in mind that each 'callback is limited, through create, to the types exposed by the variants in Callback_arity.

Currently, only a 1-arity callback is provided with local_ annotations in order to avoid an explosion due to the permutations of local_ args. It is also relatively cheap to make the one local arg a record with multiple fields.

Sourcetype _ t =
  1. | Arity1 : ('a -> unit) t
  2. | Arity1_local : ('a -> unit) t
  3. | Arity2 : ('a -> 'b -> unit) t
  4. | Arity3 : ('a -> 'b -> 'c -> unit) t
  5. | Arity4 : ('a -> 'b -> 'c -> 'd -> unit) t
  6. | Arity5 : ('a -> 'b -> 'c -> 'd -> 'e -> unit) t
Sourceval sexp_of_t : ('a__001_ -> Sexplib0.Sexp.t) -> 'a__001_ t -> Sexplib0.Sexp.t
OCaml

Innovation. Community. Security.