Linebreaks in function formatting
I have some code which looks like this:
let myfunc : int -> int = fun x ->
let y = x + 1 in
y
It gets reformatted to:
let myfunc : int -> int =
fun x ->
let y = x + 1 in
y
It'd be nice to avoid the unnecessary line break after the equals. I can take a shot at fixing this but I'd need some pointers on where to look in the code.
This code is formatted by Fmt_ast.fmt_value_binding which itself produces the code from let to =, and then uses fmt_expression to produce from fun onward. To achieve what you suggest, I think the easiest approach is to add a special case to fmt_value_binding which looks at the body of such bindings with type constraints and splits the Pexp_fun into the function arguments and body, analogously to how it is currently done for the case where there are no type constraints.
Easier after #406
I too have a bunch of code that looks like @jfeser's example, and would like this feature. Out of curiosity, what makes issues like this and #364 problematic, while --break-separators=after-and-docked is not so?
I'm not sure the fix for this one would be radically different but I don't have the time to look at this one right now, I'm working on the bugs reported lately these days.