diff --git a/.ocamlformat b/.ocamlformat index 7a64b1e..57a795d 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,4 +1,4 @@ -version=0.17.0 +version=0.26.0 break-separators=before dock-collection-brackets=false break-sequences=true diff --git a/src/pp.ml b/src/pp.ml index 0227704..886b05d 100644 --- a/src/pp.ml +++ b/src/pp.ml @@ -161,7 +161,6 @@ let rec to_fmt ppf t = Render.render ppf t ~tag_handler:(fun ppf _tag t -> to_fmt ppf t) let nop = Nop - let seq a b = Seq (a, b) let concat ?(sep = Nop) = function @@ -182,34 +181,22 @@ let concat_mapi ?(sep = Nop) l ~f = | l -> Concat (sep, List.mapi l ~f) let box ?(indent = 0) t = Box (indent, t) - let vbox ?(indent = 0) t = Vbox (indent, t) - let hbox t = Hbox t - let hvbox ?(indent = 0) t = Hvbox (indent, t) - let hovbox ?(indent = 0) t = Hovbox (indent, t) - let verbatim x = Verbatim x - let char x = Char x - let custom_break ~fits ~breaks = Break (fits, breaks) let break ~nspaces ~shift = custom_break ~fits:("", nspaces, "") ~breaks:("", shift, "") let space = break ~nspaces:1 ~shift:0 - let cut = break ~nspaces:0 ~shift:0 - let newline = Newline - let text s = Text s - let textf fmt = Printf.ksprintf text fmt - let tag tag t = Tag (tag, t) let enumerate l ~f = @@ -225,9 +212,9 @@ let chain l ~f = (seq (verbatim (if i = 0 then - " " - else - "-> ")) + " " + else + "-> ")) (f x))))) module O = struct diff --git a/src/pp.mli b/src/pp.mli index f625ad3..5bb5255 100644 --- a/src/pp.mli +++ b/src/pp.mli @@ -91,7 +91,9 @@ val newline : _ t And the top left corner of this shape is anchored where the box was declared. So for instance, the following document: - {[ Pp.verbatim "....." ++ Pp.box ~indent:2 (Pp.text "some long ... text") ]} + {[ + Pp.verbatim "....." ++ Pp.box ~indent:2 (Pp.text "some long ... text") + ]} would produce: diff --git a/test/tests.ml b/test/tests.ml index c78afc0..937bb37 100644 --- a/test/tests.ml +++ b/test/tests.ml @@ -2,11 +2,8 @@ open StdLabels open Pp.O let print pp = Format.printf "%a@." Pp.to_fmt pp - let many n pp = Array.make n pp |> Array.to_list |> Pp.concat ~sep:Pp.space - let xs n = many n (Pp.char 'x') - let ys n = many n (Pp.char 'y') let%expect_test _ =