Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
sorawee committed Feb 17, 2024
1 parent 9b0808c commit 4a6c9c3
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 197 deletions.
14 changes: 7 additions & 7 deletions doc/index.mld
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ are in scope.

{2 Putting them all together}

With the above setup, we can pretty-print [d] with the cost factory [cf] by calling [pretty_print d].
This returns a string that we can then put on screen.
With the above setup, we can pretty-print [d] with the cost factory [cf] by calling [pretty_print print_string d],
which uses [print_string] to output content.

Let's now actually use the pretty printer with page width limit of 80.

Expand Down Expand Up @@ -342,22 +342,22 @@ let my_cost_factory ~page_width ?computation_width () =

let limit = F.limit

let text pos len = (F.text pos len, 0)
let text pos len = F.text pos len, 0

let newline _ = (F.newline 0, 0)
let newline _ = F.newline 0, 0

let combine (c1, s1) (c2, s2) =
(F.combine c1 c2, s1 + s2)
F.combine c1 c2, s1 + s2

let le (c1, s1) (c2, s2) =
if c1 = c2 then
s1 <= s2
else
F.le c1 c2

let two_columns_overflow w = (F.two_columns_overflow w, 0)
let two_columns_overflow w = F.two_columns_overflow w, 0

let two_columns_bias w = (F.two_columns_bias w, 0)
let two_columns_bias w = F.two_columns_bias w, 0

let string_of_cost (c, s) = Printf.sprintf "(%s %d)" (F.string_of_cost c) s

Expand Down
Loading

0 comments on commit 4a6c9c3

Please sign in to comment.