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

Suggestion : Detect [Type].map f |> [Type].choose g and propose change to [Type].choose (f >> g) #600

Open
SteveGilham opened this issue Jun 8, 2023 · 0 comments

Comments

@SteveGilham
Copy link
Contributor

Description

Since choose does a map plus filter operation, any preceding map can be coalesced, especially in the all too common case where g is the built-in function id.

Repro steps

Code looking like

        foldername :: (Seq.toList symbolFolders)
        |> Seq.map (I.getSymbolsByFolder filename)
        |> Seq.choose id
        |> Seq.tryFind (I.symbolMatch tokens)

Would-be-nice behavior

Hint to the effect that

        foldername :: (Seq.toList symbolFolders)
        |> Seq.choose (I.getSymbolsByFolder filename)
        |> Seq.tryFind (I.symbolMatch tokens)

would be simpler

Actual behavior

No such hint

Known workarounds

Manual check/code review

Related information

FWIW, latest tool release under dotnet 7.0.302 on Windows 10 Home

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

No branches or pull requests

1 participant