Visitor.FoldVisitor that accumulates over the nodes of the tree.
type 'a action = 'a folding_actiontype ('x, 'a) fold = 'x -> 'a -> 'a folding_actionSome combinators to write more readable folding visitors
val skip_children : 'a -> 'a folding_actionval skip : 'a -> 'a folding_actionval do_children : 'a -> 'a folding_actionval proceed : 'a -> 'a folding_actionval do_children_and_then : 'a -> ('a -> 'a) -> 'a folding_actionval proceed_and_then : 'a -> ('a -> 'a) -> 'a folding_actionval default : 'a -> 'b -> 'b folding_actionAction handling
val handle :
('a -> 'b -> 'b action) ->
continue:('a -> 'b -> 'b) ->
'a ->
'b ->
'bhandle fold continue node acc first calls fold node acc, and then behaves according to the action returned.
val leaf : ('x -> 'a -> 'a action) -> 'x -> 'a -> 'aleaf fold node acc calls fold node acc and returns immediately (after executing the post action, if fold returns DoChildrenAndThen).
class 'a folder : object ... endBase folding visitor.
Entry points for folding over some basic types.
val fold_bool : 'a folder -> bool -> 'a -> 'aval fold_char : 'a folder -> char -> 'a -> 'aval fold_int : 'a folder -> int -> 'a -> 'aval fold_string : 'a folder -> string -> 'a -> 'aGeneric entry points.
val fold_option :
fold:(('b folder as 'a) -> 'c -> 'b -> 'b) ->
'd ->
'c option ->
'b ->
'bval fold_list :
fold:(('b folder as 'a) -> 'c -> 'b -> 'b) ->
'd ->
'c list ->
'b ->
'bval fold_nel :
fold:(('b folder as 'a) -> 'c -> 'b -> 'b) ->
'd ->
'c Basics.NEL.t ->
'b ->
'bval fold' :
fold:(('b folder as 'a) -> 'c -> 'b -> 'b) ->
'd ->
'c Srcloc.TYPES.with_loc ->
'b ->
'bval fold_int' : 'a folder -> int Srcloc.TYPES.with_loc -> 'a -> 'aval fold_int'_opt : 'a folder -> int Srcloc.TYPES.with_loc option -> 'a -> 'aval fold_string' : 'a folder -> string Srcloc.TYPES.with_loc -> 'a -> 'aval fold_string'_opt :
'a folder ->
string Srcloc.TYPES.with_loc option ->
'a ->
'aval fold_with_loc_list :
fold:(('b folder as 'a) -> 'c -> 'b -> 'b) ->
'd ->
'c Srcloc.TYPES.with_loc list ->
'b ->
'bval handle' :
('a Srcloc.TYPES.with_loc -> 'x -> 'x action) ->
fold:(('x folder as 'b) -> 'a -> 'x -> 'x) ->
'b ->
'a Srcloc.TYPES.with_loc ->
'x ->
'xHelper to shorten definitions for traversal of nodes with source locations
val leaf' :
('a Srcloc.TYPES.with_loc -> 'b -> 'b action) ->
'b folder ->
'a Srcloc.TYPES.with_loc ->
'b ->
'bReports a missing folding visitor implementation once. Use __POS__ as first argument