Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Modifier.SSourceThe signature of the engine.
module Param : sig ... endmodule type Perform = sig ... endThe signature of a module implementing all effect handlers for a modifier engine.
type not_found_handler = Param.context option -> Trie.bwd_path -> unitThe type of a handler of the Modifier.S.Perform.not_found effect.
type shadow_handler =
Param.context option ->
Trie.bwd_path ->
(Param.data * Param.tag) ->
(Param.data * Param.tag) ->
Param.data * Param.tagThe type of a handler of the Modifier.S.Perform.shadow effect.
type hook_handler =
Param.context option ->
Trie.bwd_path ->
Param.hook ->
(Param.data, Param.tag) Trie.t ->
(Param.data, Param.tag) Trie.tThe type of a handler of the Modifier.S.Perform.hook effect.
val modify :
?context:Param.context ->
?prefix:Trie.bwd_path ->
Param.hook Language.t ->
(Param.data, Param.tag) Trie.t ->
(Param.data, Param.tag) Trie.tmodify modifier trie runs the modifier on the trie and return the transformed trie.
val run :
?not_found:not_found_handler ->
?shadow:shadow_handler ->
?hook:hook_handler ->
(unit -> 'a) ->
'arun f initializes the engine and runs the thunk f.
val try_with :
?not_found:not_found_handler ->
?shadow:shadow_handler ->
?hook:hook_handler ->
(unit -> 'a) ->
'atry_with f runs the thunk f and intercepts modifier effects. See the documentation of run for the meaning of the optional effect interceptors; the difference is that the default interceptors reperform the intercepted modifier effects instead of silencing them.
try_with is intended to be used within run to intercept or reperform effects, while run is intended to be at the top-level to set up the environment and handle effects by itself. That is, the following is the expected program structure:
run ~not_found ~shadow ~hook @@ fun () ->
(* code *)
try_with ~not_found @@ fun () ->
(* more code *)
try_with ~shadow @@ fun () ->
(* even more code *)