# Ocamlformat: infix apply with function definition

**URL:** <https://discuss.ocaml.org/t/ocamlformat-infix-apply-with-function-definition/16546>\
**Category:** Ecosystem\
**Created:** [April 24, 2025, 3:58pm UTC](https://discuss.ocaml.org/t/ocamlformat-infix-apply-with-function-definition/16546 "2025-04-24T15:58:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EmileTrotignon](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/emiletrotignon/32/5913_2.png) [@EmileTrotignon](https://discuss.ocaml.org/u/EmileTrotignon)\
**Post date:** [April 24, 2025, 3:58pm UTC](https://discuss.ocaml.org/t/ocamlformat-infix-apply-with-function-definition/16546/1 "2025-04-24T15:58:16Z")

</div>

I have opened a [PR](https://github.com/ocaml-ppx/ocamlformat/pull/2694) on ocamlformat that promotes a very nice formatting that was only available to users of `--ocp-indent-compat`:

```ocaml
let () =
  fooooo
  |>>>>> List.iter (fun a ->
             let x =
               some_really_really_really_long_name_that_doesn't_fit_on_the_line
               $ y
             in
             fooooooooooo x)

```

becomes

```ocaml
let () =
  fooooo
  |>>>>> List.iter (fun a ->
      let x =
        some_really_really_really_long_name_that_doesn't_fit_on_the_line $ y
      in
      fooooooooooo x)

```

Before, there was an indentation of `4` that was aligned with `List`, now there is an indentation of 4 that is aligned on `|>>>>>`.

Of course, such a big infix operator is quite rare in real code, with `|>` the indentation is only reduced by 3 (2 for `|>`, and one for the space after it). One of the benefits is that you now have an odd number of spaces which might be desirable depending on editor config.

Still, this is quite a large change, so I wanted to ask the community if you think its worth the diff to merge that in for everyone ?

If enough people don’t like this, we can make an option to either opt-in or out of this.

Ps: this won’t affect people using `profile=janestreet`, because this profile has `ocp-indent-compat` enabled and therefore already has this formatting.

---

<div class="post-metadata">

**Author:** ![EmileTrotignon](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/emiletrotignon/32/5913_2.png) [@EmileTrotignon](https://discuss.ocaml.org/u/EmileTrotignon)\
**Post date:** [May 2, 2025, 7:48am UTC](https://discuss.ocaml.org/t/ocamlformat-infix-apply-with-function-definition/16546/2 "2025-05-02T07:48:52Z")

</div>

We have merged the PR, this will be the formatting by next release.
