[BLOG] Pretty Printing in OCaml: Format Primer

Hi folks, I wrote another monad Format tutorial.

https://keleshev.com/pretty-printing-in-ocaml-a-format-primer

Here’s some of layouts that are covered:

[[],
 ["one", "two", "three"],
 ["one",
  "two",
  "three",
  "four",
  "five",
  "six",
  "seven",
  "eight",
  "nine",
  "ten"]]

[
  [],
  ["one", "two", "three"],
  [
    "one",
    "two",
    "three",
    "four",
    "five",
    "six",
    "seven",
    "eight",
    "nine",
    "ten",
  ]
]

[ []
, [ "one", "two", "three" ]
, [ "one"
  , "two"
  , "three"
  , "four"
  , "five"
  , "six"
  , "seven"
  , "eight"
  , "nine"
  , "ten"
  ]
]

I tried to share some of my experience using Format. As a bonus—JSON pretty printer.

13 Likes