Skip to content

Lambda functions passed into HOFs #1221

Closed
@nojaf

Description

I propose we add an alternative way of formatting lambda functions passed into HOFs as describe by the G-Research style guide.

The existing way of Fantomas deals with this problem is following the Microsoft style guide without any options.

Pros and Cons

The advantages of making this adjustment to Fantomas are following both style guides,

The disadvantages of making this adjustment to Fantomas are introducing a new setting and maintaining both choices.

Examples

List.collect (fun (a, element) ->
    let path' =
        path
        |> someFunctionToCalculateThing

    innerFunc<'a, 'b>
        path'
        element
        (foo >> bar value >> List.item a)
        shape
)

let mySuperFunction a =
    someOtherFunction a (fun b ->
        // doing some stuff her
       b * b
    )

Things to keep in mind:

  • This seems to only have an impact on multiline constructs
  • There can be arguments before and after the lambda.
  • What with multiple lambdas?
  • Desugared lambdas?
  • Setting name?

Extra information

Estimated cost (XS, S, M, L, XL, XXL): L

Related suggestions: #1189

I think this feature cannot be implemented in one go. It will be a back and forward collaboration between trying things out in Fantomas and further polishing the style guide.

Affidavit (please submit!)

Please tick this by placing a cross in the box:

Please tick all that apply:

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions