Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter: start long lambda clause body on a new line #2014

Closed
paulcadman opened this issue Apr 18, 2023 · 0 comments · Fixed by #2015
Closed

Formatter: start long lambda clause body on a new line #2014

paulcadman opened this issue Apr 18, 2023 · 0 comments · Fixed by #2015
Assignees
Labels
enhancement New feature or request juvix-formatter
Milestone

Comments

@paulcadman
Copy link
Collaborator

The following example contains a lambda clause that does not fit onto one line.

f : Nat -> Nat;
f :=
  \ {
    | zero := let foo : Nat := 1;in foo
    | _ := 1
  };

It currently gets formatted to:

f : Nat -> Nat;
f :=
  \ {
    | zero := let
      foo : Nat := 1;
    in foo
    | _ := 1
  };

We should format lambda clause bodies in the same way as function bodies. i.e the body should start on a new line if it is too long to fit on one line:

f : Nat -> Nat;
f :=
  \ {
    | zero :=
      let
        foo : Nat := 1;
      in foo
    | _ := 1
  };
@paulcadman paulcadman added enhancement New feature or request juvix-formatter labels Apr 18, 2023
@paulcadman paulcadman added this to the 0.3.3 milestone Apr 18, 2023
@paulcadman paulcadman self-assigned this Apr 18, 2023
paulcadman added a commit that referenced this issue Apr 18, 2023
This PR modifies the pretty printer for lambda clauses so that the body
will start on a new line if it is too long to fit on a single line. This
is exactly how we handle function clause bodies.

* Closes #2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request juvix-formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant