ocamlformat configs with some people, one interesting point came out. The vast majority of existing OCaml code is formatted using
type_indent = 2 and
match_indent = 0 ( using
type t = | A | B match x with | A -> ... | B -> ...
Is there good justification for this (other that it has been the default for
ocp-indent and now
ocamlformat too)? Wouldn’t it been more consistent to use
match_indent = 2, e.g.
match x with | A -> ... | B -> ...
One argument I can think of is that matching without the first optional vertical bar looks nicer this way:
match x with A -> ... | B -> ...
But you can also do the same for type definitions as well
type t = A | B