Library
Module
Module type
Parameter
Class
Class type
The Action
module implements the engine running the patterns.
The engine tries to preserve physical equality whenever feasible. For example, if the trie t
has a binding at x
, the pattern Pattern.renaming
["x"] ["x"]
on t
will return the original t
.
type nonrec ('a, 'error) result =
('a Trie.t, [> `BindingNotFound of Pattern.path ] as 'error) result
The type of the result. The error `BindingNotFound
means that the engine expected at least one binding under path
but could not find it.
val run :
?rev_prefix:Pattern.path ->
union:(rev_path:Pattern.path -> 'a -> 'a -> 'a) ->
unit Pattern.t ->
'a Trie.t ->
('a, 'error) result
run ~rev_prefix ~union pattern trie
runs the pattern
on the trie
and return the transformed trie. It ignores patterns created by Pattern.hook
.
val run_with_hooks :
?rev_prefix:Pattern.path ->
union:(rev_path:Pattern.path -> 'a -> 'a -> 'a) ->
hooks:('hook -> rev_prefix:Pattern.path -> 'a Trie.t -> ('a, 'error) result) ->
'hook Pattern.t ->
'a Trie.t ->
('a, 'error) result
run_with_hooks ~rev_prefix ~hooks ~union pattern trie
runs the pattern
on the trie
and return the transformed trie. It is similar to run
but accepts a new argument hooks
to handle the patterns created by Pattern.hook
.
val pp_path : Format.formatter -> Pattern.path -> unit
Pretty printer for path
.