package yuujinchou

  1. Overview
  2. Docs

Parameters

module H : Handler

Signature

val run : ?export_prefix:Trie.bwd_path -> ?init_visible:(Param.data, Param.tag) Trie.t -> (unit -> 'a) -> 'a

run f h initializes a scope and executes the thunk f, using h to handle modifier effects.

  • parameter export_prefix

    The additional global prefix prepended to the paths reported to effect handlers originating from export namespaces. The default is the empty path (Emp). This does not affect paths originating from visible namespaces.

  • parameter init_visible

    The initial visible namespace. The default is the empty trie.

val try_with : (unit -> 'a) -> 'a

Execute the code and handles the internal modifier effects. This can be used to intercept or reperform those effects; for example, the following function silences the shadow effects. See also Modifier.S.Run.try_with.

module H =
struct
  include Perform
  let shadow _ _ _ y = y
end

let silence_shadow f = let module R = Run (H) in R.try_with f

Note that run starts a fresh empty scope while try_with remains in the current scope.

OCaml

Innovation. Community. Security.