jfmengels / elm-review-simplify

Provides elm-review rules to simplify your Elm code
https://package.elm-lang.org/packages/jfmengels/elm-review-simplify/latest/
BSD 3-Clause "New" or "Revised" License
20 stars 9 forks source link

Add Tuple.pair a b --> ( a, b ) #163

Closed lue-bird closed 12 months ago

lue-bird commented 12 months ago

To complete the suggested tuple simplifications from #2

Tuple.pair a b
--> ( a, b )

It's pretty easy to mess indentation up with these fixes that use extractSourceCode, so the fix preserves it 1:1.

I'm not really sure about the error details on this one. Why is the code obviously better after the simplification?

jfmengels commented 12 months ago

This also changes

a
  |> f
  |> Tuple.pair g
-->
( g,
  a
  |> f
)

which I don't think we want in this specific instance. Pipelining (and partial application) is almost the only "valid" uses I see/have for Tuple.pair. Not handling this should make the fix much simpler too