package yuujinchou

  1. Overview
  2. Docs


module H : Handler


val run : ?export_prefix:Trie.bwd_path -> ?init_visible:(, 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 =
  include Perform
  let shadow _ _ _ y = y

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.


Innovation. Community. Security.