ocamlformat icon indicating copy to clipboard operation
ocamlformat copied to clipboard

Indentation feels off for mutually recursive functions with type constraints

Open AltGr opened this issue 3 years ago • 0 comments

The indentation feels off in the following example:

let rec equal_list :
          'a. ('a, 't) gexpr marked list -> ('a, 't) gexpr marked list -> bool =
 fun es1 es2 ->
  try List.for_all2 equal es1 es2 with Invalid_argument _ -> false

and equal : 'a. ('a, 't) gexpr marked -> ('a, 't) gexpr marked -> bool =
  fun (type a) (e1 : (a, 't) gexpr marked) (e2 : (a, 't) gexpr marked) ->
   match Marked.unmark e1, Marked.unmark e2 with
   …
  • indentation for the type of equal_list is huge
  • first fun is indented 1 and its body 2, it feels weird to have width-1 increments. Why not 2 and 4, or, better, 2 and 2 ? I'd even be ok with 0 and 2
  • the second fun is indented 2 and its body 3, which is one more than for the first function and doesn't feel consistent
profile = default
margin = 80
exp-grouping = preserve
break-fun-decl = fit-or-vertical
wrap-comments
parse-docstrings
version=0.24.1
cases-exp-indent=2
indicate-multiline-delimiters=no
parens-tuple=multi-line-only
space-around-lists=false
break-infix-before-func
break-infix= fit-or-vertical

AltGr avatar Aug 17 '22 10:08 AltGr