val with_return : ('a return -> 'a) -> 'a
val with_return_option : ('a return -> unit) -> 'a option
Note that
with_return_option
allocates ~5 words more than the equivalentwith_return
call.
val prepend : 'a return -> f:('b -> 'a) -> 'b return
prepend a ~f
returns a valuex
such that each call tox.return
first appliesf
before applyinga.return
. The call tof
is "prepended" to the call to the originala.return
. A possible use case is to handx
over to another function which returns'b
, a subtype of'a
, or to capture a common transformationf
applied to returned values at several call sites.