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
19 stars 9 forks source link

Add andThen composition after wrap simplifications #245

Closed lue-bird closed 1 year ago

lue-bird commented 1 year ago

Adds andThen f << wrap --> f composition simplifications.

Maybe.andThen f << Just --> f
Result.andThen f << Ok --> f
Json.Decode.andThen f << Json.Decode.succeed --> f
Random.andThen f << Random.constant --> f
List.concatMap f << List.singleton --> f
Task.andThen f << Task.succeed --> f
Task.onError f << Task.fail --> f

If you think there are andThen functions missing in this list, please comment.

Fixing the List.map on singleton fix in the next PR.

github-actions[bot] commented 1 year ago

The branch can be tried out by running:

elm-review --template jfmengels/elm-review-simplify/preview