jfmengels/elm-review-simplify

Simplify `if x then True else y` to `x || y`

Open

#12 opened on Jul 19, 2021

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Elm (10 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (22 stars)
PR merge metrics
 (PR metrics pending)

Description

Stumbled across it in my (old, shameful) code the other day, but the following simplifications could be added:

if foo then
    True
else
    bar

to

foo || bar

and similarly

if foo then
    bar
else
    False

to

foo && bar

Should be easy to implement if you agree they should be, but don't want to put time into it if you disagree. :smile:

Contributor guide