Skip to content

Enforce one style of OCaml matching constructors #1091

@Niols

Description

@Niols

On pattern matching, OCaml is rather lenient on the parentheses because there are no grammar conflicts. So for instance if you have an x : int option option, you can write both:

match x with
| Some (Some y) -> y
| Some Some y -> y

and they do the same thing and are perfectly valid. As a formatter, I think I would expect Topiary to choose and enforce one of those styles. I personally like the latter, but I think a formatter should choose the former as it will be much less surprising to a random developer. As of 5081cce (main as of writing this issue), Topiary does not choose and would format the given snippet as-is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions