Skip to content

Feature request: Return types on anonymous functions #1368

@adamsmd

Description

@adamsmd

Is your feature request related to a problem? Please describe.

There might already be an option for this, but I haven't been able to find one. If there is, please let me know.

ocamlformat moves the return types of anonymous functions after the body of the function, but I want it to put the type after the arguments of the function

Here is what I want:

fun (x : int) : int -> some_large_computation

Here is what ocamlformat produces:

fun (x : int) -> (some_large_computation : int)

You can test this with:

echo 'fun (x: int): int -> some_large_computation' | ocamlformat --impl --enable-outside-detected-project -

Describe the solution you'd like

I'd like an option that makes ocamlformat produces the first and not the second.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions