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

Add explicit section in regards to multiline expressions in let bindings #23

Open
nojaf opened this issue Mar 22, 2021 · 1 comment · May be fixed by #24
Open

Add explicit section in regards to multiline expressions in let bindings #23

nojaf opened this issue Mar 22, 2021 · 1 comment · May be fixed by #24

Comments

@nojaf
Copy link
Contributor

nojaf commented Mar 22, 2021

Following up on the previous issue, I'd like to see a small section about what to do with multiline body expressions in let and member bindings.
Example:

let functionName x y = a

if a is long or multiline it should be placed on the next line with an indent.

let functionName x y = 
    a

regardless of what SynExpr a ends up being.

Some examples I consider bad:

let a = """
foobar, long string
"""

let b = async {
    return () // not following the other CE samples
}

let c = {
    Name = "Bilbo"
    Age = 112
}

let d = while f do
    printfn "%A" x

From my (technical) point of view, the only a few SynExpr that can start right after the = sign and it strikes me as inconsistent to have these.
The only one I could find in the current guide is:

let rec sizeLambda acc = function
    | Abs(x, body) -> sizeLambda (succ acc) body
    | App(lam1, lam2) -> sizeLambda (sizeLambda acc lam1) lam2
    | Var v -> succ acc

As MatchLambda is only 1 of 63 SynExpr cases, this just seems like not worth having.

@Smaug123
Copy link
Contributor

In all cases I think you're correct and those are bad. I'll make a PR for that.

Smaug123 added a commit that referenced this issue Mar 22, 2021
@Smaug123 Smaug123 linked a pull request Mar 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants