fsharp-formatting-conventions icon indicating copy to clipboard operation
fsharp-formatting-conventions copied to clipboard

Many lambda parameters

Open nojaf opened this issue 4 years ago • 1 comments

What would happen in the following code snippet?

module MyModule =

    let foo: Foo -> Foo =
        BigLongTypee.doStuff<aaaaaaaaaaaaa, bbbbbb, BigLongTypee> (fun aaa bbbbbb (CCC ccc) ddddddddddd (EEEE eee) (FFF fff) ggggg ->
            failwith "Not important"
        )

nojaf avatar Dec 19 '20 21:12 nojaf

Sorry, I completely missed this!

With a sufficiently short line length, I think the following:

    let foo : Foo -> Foo =
        BigLongTypee.doStuff<
                aaaaaaaaaaaaa,
                bbbbbb,
                BigLongTypee
            >
            (fun aaa
                bbbbbb
                (CCC ccc)
                ddddddddddd
                (EEEE eee)
                (FFF fff)
                ggggg
                 ->
                failwith "Not important"
            )

The very last thing to break over lines is the generic type parameters, ideally; they only break if they absolutely must.

I haven't discussed this with the team yet, though, so this is not totally certain. It never really comes up.

Smaug123 avatar Jan 19 '21 21:01 Smaug123