Skip to content

Dict.toList >> List.map with lambda ignoring tuple element #468

Description

@jfmengels
someDict
  |> Dict.toList
  |> List.map (\( k, _ ) -> f k)
-->
someDict
  |> Dict.keys
  |> List.map (\k -> f k)

We already have a check to see if the argument to List.map is Tuple.first (or a lambda equivalent). I think we should maybe (instead, or in addition to) check whether the second part of the tuple gets ignored.

someDict
  |> Dict.toList
  |> List.map Tuple.first
-->
someDict
  |> Dict.keys
  |> List.map identity -- will get simplified afterwards

someDict
  |> Dict.toList
  |> List.map (\( k, _ ) -> f k)
-->
someDict
  |> Dict.keys
  |> List.map (\k -> f k)

Same for Tuple.second.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions