Make.Format_state
include Support.Imperative_state.IMPERATIVE_STATE
val traverse_list :
state ->
(state -> 'a -> 'b) ->
'a Support.List.t ->
'b Support.List.t
traverse_list state f [x1; x2; ...; xn]
is [y1; y2; ...; yn]
where yi = f state xi
, and y1
, y2
, ..., yn
are computed in order, meaning that y1
is computed first, then y2
, etc.
val traverse_list1 :
state ->
(state -> 'a -> 'b) ->
'a Support.List1.t ->
'b Support.List1.t
val traverse_list2 :
state ->
(state -> 'a -> 'b) ->
'a Support.List2.t ->
'b Support.List2.t
val iter_list :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List.t ->
Stdlib.Unit.t
iter_list state f [x1; x2; ...; xn]
is f state x1; f state x2; ...; f state xn
.
val iter_list1 :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List1.t ->
Stdlib.Unit.t
val iter_list2 :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List2.t ->
Stdlib.Unit.t
val traverse_reverse_list :
state ->
(state -> 'a -> 'b) ->
'a Support.List.t ->
'b Support.List.t
traverse_reverse_list state f [x1; x2; ...; xn]
is [y1; y2; ...; yn]
where yi = f state xi
, and y1
, y2
, ..., yn
are computed in reverse order, meaning that yn
is computed first, then y(n-1)
, etc.
val traverse_reverse_list1 :
state ->
(state -> 'a -> 'b) ->
'a Support.List1.t ->
'b Support.List1.t
val traverse_reverse_list2 :
state ->
(state -> 'a -> 'b) ->
'a Support.List2.t ->
'b Support.List2.t
val iter_rev_list :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List.t ->
Stdlib.Unit.t
iter_rev_list state f [x1; x2; ...; xn]
is f state xn; f state x(n-1); ...; f state x1
.
val iter_rev_list1 :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List1.t ->
Stdlib.Unit.t
val iter_rev_list2 :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List2.t ->
Stdlib.Unit.t
val traverse_option :
state ->
(state -> 'a -> 'b) ->
'a Support.Option.t ->
'b Support.Option.t
val iter_option :
state ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.Option.t ->
Stdlib.Unit.t
val seq_list : state -> (state -> 'a) Support.List.t -> 'a Support.List.t
val seq_list1 : state -> (state -> 'a) Support.List1.t -> 'a Support.List1.t
val iter_seq :
state ->
(state -> Stdlib.Unit.t) Support.List.t ->
Stdlib.Unit.t
val pp_flush : state -> Stdlib.Unit.t
pp_flush state
is analogous to Format.pp_print_flush
.
val pp_newline : state -> Stdlib.Unit.t
pp_newline state
is analogous to Format.pp_print_newline
.
val pp_nop : state -> Stdlib.Unit.t
pp_nop state
is ()
. This is useful to signal that nothing should be printed for some execution branch.
val pp_cut : state -> Stdlib.Unit.t
pp_cut state
is analogous to Format.pp_print_cut
.
val pp_space : state -> Stdlib.Unit.t
pp_space state
is analogous to Format.pp_print_space
. Note that this is a possibly breaking space, meaning that a newline may be printed at this point.
val pp_non_breaking_space : state -> Stdlib.Unit.t
pp_non_breaking_space state
pretty-prints a non-breaking space, meaning that the printer does not insert break directives to that space.
val pp_break : state -> Support.Int.t -> Support.Int.t -> Stdlib.Unit.t
pp_break state width offset
is analogous to Format.pp_print_break
.
val pp_as : state -> Support.Int.t -> Support.String.t -> Stdlib.Unit.t
pp_as state size
is analogous to Format.pp_print_as
to pretty-print a string as if it were of length size
. This is useful to pretty-print UTF-8 encoded strings of known codepoint count, or to print a string as if it isn't there, like for HTML tags or ASCII escape sequences.
val pp_box :
state ->
?indent:Support.Int.t ->
(state -> Stdlib.Unit.t) ->
Stdlib.Unit.t
pp_box state ?(indent = 0) f
evaluates f state
in a compacting pretty-printing box wth offset indent
in the formatter (see Format.pp_open_box
). The box is opened before f state
, and closed afterwards.
pp_hbox state f
evaluates f state
in a horizontal pretty-printing box (see Format.pp_open_hbox
). The box is opened before f state
, and closed afterwards.
val pp_vbox :
state ->
?indent:Support.Int.t ->
(state -> Stdlib.Unit.t) ->
Stdlib.Unit.t
pp_vbox state ?(indent = 0) f
evaluates f state
in a vertical pretty-printing box with offset indent
(see Format.pp_open_vbox
). The box is opened before f state
, and closed afterwards.
val pp_hvbox :
state ->
?indent:Support.Int.t ->
(state -> Stdlib.Unit.t) ->
Stdlib.Unit.t
val pp_hovbox :
state ->
?indent:Support.Int.t ->
(state -> Stdlib.Unit.t) ->
Stdlib.Unit.t
val pp_bool : state -> Stdlib.Bool.t -> Stdlib.Unit.t
val pp_int : state -> Support.Int.t -> Stdlib.Unit.t
val pp_float : state -> Stdlib.Float.t -> Stdlib.Unit.t
val pp_char : state -> Stdlib.Char.t -> Stdlib.Unit.t
val pp_string : state -> Support.String.t -> Stdlib.Unit.t
val pp_option :
state ->
?none:(state -> Stdlib.Unit.t) ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.Option.t ->
Stdlib.Unit.t
val pp_list :
state ->
?sep:(state -> Stdlib.Unit.t) ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List.t ->
Stdlib.Unit.t
val pp_list1 :
state ->
?sep:(state -> Stdlib.Unit.t) ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List1.t ->
Stdlib.Unit.t
val pp_list2 :
state ->
?sep:(state -> Stdlib.Unit.t) ->
(state -> 'a -> Stdlib.Unit.t) ->
'a Support.List2.t ->
Stdlib.Unit.t
val pp_text : state -> Support.String.t -> Stdlib.Unit.t
val pp_utf_8 : state -> Support.String.t -> Stdlib.Unit.t
val pp_utf_8_text : state -> Support.String.t -> Stdlib.Unit.t