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 improvements #3194

Merged
merged 5 commits into from
Nov 29, 2024
Merged

Formatter improvements #3194

merged 5 commits into from
Nov 29, 2024

Conversation

janmasrovira
Copy link
Collaborator

@janmasrovira janmasrovira commented Nov 27, 2024

  1. Closes Lambda functions miss the first pipe when formatted #3192. The first pipe is ensured in a multi-clause lambda.
  2. Bugfix: Pragmas are now properly printed for deriving statements. Previously they were never printed.
  3. Record types are always declared in a new line, even if they have a single constructor and fit in a line. I think this change improves readability.
    -- before
    type Eq A := mkEq@{builtin isEqual eq : A -> A -> Bool};
    
    -- after
    type Eq A :=
      mkEq@{
        builtin isEqual
        eq : A -> A -> Bool;
      };
    
  4. I've formatted the stdlib (Format juvix-stdlib#150).
  5. I've refactored some code related to adding the first pipe so that it is reused for cases, lambdas and types.
  6. Now ConstructorDef has a proper PrettyCode instance and does not need to be passed a bool indicating whether it is the only constructor in a definition.

@janmasrovira janmasrovira self-assigned this Nov 27, 2024
@janmasrovira janmasrovira changed the title Refactor code to insert first pipe when missing Formatter improvements Nov 27, 2024
@janmasrovira janmasrovira marked this pull request as ready for review November 27, 2024 16:13
@paulcadman paulcadman added this to the 0.6.9 milestone Nov 27, 2024
lukaszcz
lukaszcz previously approved these changes Nov 28, 2024
paulcadman
paulcadman previously approved these changes Nov 28, 2024
@janmasrovira janmasrovira merged commit bf06cb1 into main Nov 29, 2024
4 checks passed
@janmasrovira janmasrovira deleted the format-changes branch November 29, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lambda functions miss the first pipe when formatted
3 participants