OCamlPro / ocp-indent

Indentation tool for OCaml, to be used from editors like Emacs and Vim.
http://www.typerex.org/ocp-indent.html
Other
200 stars 63 forks source link

Avoid indentation of `fun`. #188

Closed dbuenzli closed 5 years ago

dbuenzli commented 9 years ago

@drup wants to be able to write:

val f : t1 -> t2 -> t3
let f x y z = ...

at which @chris00 responds you can write:

let f : t1 -> t2 -> t3 =
  fun x y z -> ...

which I'd gladly use (e.g. in blog posts I write things like @drup but then it makes the code not easily copy pastable in bulk). However I'm sad to loose what is going to be likely 4 columns (assuming the function spans more than one line). Would it be possible to avoid the fun indentation ?

let f : t1 -> t2 -> t3 =
fun x y z -> ...

(at which point you realize github's syntax higlighting is indentation aware)

Drup commented 9 years ago

In practice when doing gadt things, you are forced to write it like that, so yes, that would be nice.

Chris00 commented 9 years ago

FWIW, Tuareg indents it like:

let f : t1 -> t2 -> t3 =
  fun x y z ->
  xxx

so you do not have a 4 columns indent.

dbuenzli commented 8 years ago

I miss this (non)indentation rule a lot.

dbuenzli commented 5 years ago

Thanks !