I am looking for a code formatter or pretty printer for ocaml. Something like gofmt for the go programming language. It should preferably preserve comments.
I am correcting hand-ins and some of the code is formatted in a way that makes it very hard to read.
if you don’t care about comments, you can use camlp4:
Or you can use external indenter tools, as ocp-indent.