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

Coding style for elm-format contributors #737

Open
avh4 opened this issue May 20, 2021 · 0 comments
Open

Coding style for elm-format contributors #737

avh4 opened this issue May 20, 2021 · 0 comments

Comments

@avh4
Copy link
Owner

avh4 commented May 20, 2021

for coding style, it’s currently a bit of a mess, and is just best judgement based on nearby code.

I try to use these rules myself:

  • for files that were copied from elm-compiler, touch them as little as possible, and try to keep the same formatting style as the originals (so that they’re easier to compare with future updates to elm-compiler)
  • for other files, if I’m changing some code, sometimes I will update the formatting of the code right around it, but I try to avoid reformatting code in a PR that’s unrelated to the code change
  • add type annotations for anything newly hand-written that’s top-level

and I guess the style I’ve been sort of using for new code is: 4-space indents, using LambdaCase when possible, and:

if p
    then x
    else y

let
    f = x
in
body

f x y =
    do
        ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant