The rule also simplifies:
Set.fromList [ a, a ]
toSet.fromList [ a ]
Dict.fromList [ ( a, v0 ), ( a, v1 ) ]
toDict.fromList [ ( a, v1 ) ]
2.1.5 - 2024-06-28
The rule also simplifies (thanks to @morteako):
Set.isEmpty (Set.fromList list)
toList.isEmpty list
Dict.isEmpty (Dict.fromList list)
toList.isEmpty list
Array.isEmpty (Array.fromList list)
toList.isEmpty list
Other improvements:
- Improved the error message for the
data |> (f >> g)
simplification
2.1.4 - 2024-04-01
The rule now simplifies unnecessary wrapping of values evaluated by a case expression:
case Just value of
Nothing -> a
Just (Ok b) -> c
Just (Err d) -> e
is simplified to
case value of
Ok b -> c
Err d -> e
(same with any variant, list or tuple containing either)
The rule also simplifies (thanks to @morteako):
Array.length (Array.fromList list)
toList.length list
List.length (Array.toList array)
toArray.length array
(same forArray.toIndexedList
)List.isEmpty (Array.toList array)
toArray.isEmpty array
(same forArray.toIndexedList
)List.length (Set.toList set)
toSet.size set
List.isEmpty (Set.toList set)
toSet.isEmpty set
List.length (Dict.toList dict)
toDict.size dict
(same forDict.values
andDict.keys
)List.isEmpty (Dict.toList dict)
toDict.isEmpty dict
(same forDict.values
andDict.keys
)
Bug fixes:
- Fixed an issue where
String.words ""
would incorrectly be fixed to[]
. Thanks @w0rm and @lue-bird! #300 - Fixed an issue where
String.lines ""
would incorrectly be fixed to[]
. Thanks @w0rm and @lue-bird! #300
2.1.3 - 2023-10-23
The rule now simplifies:
- composition checks now also detect function pairs across nested compositions like
(here << ...) >> (... << there)
List.sort (List.sort list)
toList.sort list
List.sortBy f (List.sortBy f list)
toList.sortBy f list
String.concat (List.repeat n str)
toString.repeat n str
String.concat (List.intersperse str strings)
toString.join str strings
Set.foldl/r f initial Set.empty
toinitial
Set.foldl/r (\_ soFar -> soFar) initial set
toinitial
Set.union set set
toset
Set.intersect set set
toset
String.foldl/r f initial ""
toinitial
String.foldl/r (\_ soFar -> soFar) initial string
toinitial
Result.fromMaybe x (Just a)
toOk a
Result.fromMaybe x Nothing
toErr x
- the same operations for
Json.Decode.map
as for e.g.Task.map
andResult.map
- the same operations for
Json.Decode.map2-8
as for e.g.Task.mapN
andResult.mapN
- the same operations for
Json.Decode.andThen
as for e.g.Task.andThen
andResult.andThen
Tuple.first (Tuple.mapSecond changeFirst tuple)
toTuple.first tuple
Tuple.first (Tuple.mapBoth changeFirst changeSecond tuple)
toTuple.first (Tuple.mapFirst changeFirst tuple)
Tuple.second (Tuple.mapFirst changeSecond tuple)
toTuple.second tuple
Tuple.second (Tuple.mapBoth changeFirst changeSecond tuple)
toTuple.second (Tuple.mapSecond changeSecond tuple)
Maybe.withDefault a << Just
toidentity
Result.withDefault a << Ok
toidentity
List.sum << List.singleton
toidentity
List.product << List.singleton
toidentity
List.concat << List.singleton
toidentity
Platform.Cmd.batch << List.singleton
toidentity
Platform.Sub.batch << List.singleton
toidentity
List.minimum << List.singleton
toJust
List.maximum << List.singleton
toJust
Maybe.map2 f firstMaybe Nothing
toNothing
(same for all Maybe.mapN)Maybe.map2 f (Just a) (Just b)
toJust (f a b)
(same for all Maybe.mapN)Array.get 2 (Array.repeat 10 x)
->Just x
Array.get 100 (Array.repeat 10 x)
->Nothing
Array.get 2 (Array.initialize 10 f)
->Just (f 2)
Array.get 100 (Array.initialize 10 f)
->Nothing
Array.foldl f initial Array.empty
toinitial
(same forArray.foldr
)Array.foldl (\_ soFar -> soFar) initial array
toinitial
(same forArray.foldr
)Array.toList Array.empty
to[]
Array.toList (Array.repeat n a)
toList.repeat n a
Array.toIndexedList Array.empty
to[]
Array.slice n n array
toArray.empty
Array.slice n 0 array
toArray.empty
Array.slice a z Array.empty
toArray.empty
Array.slice 2 1 array
toArray.empty
Array.slice -1 -2 array
toArray.empty
List.map Tuple.second (Array.toIndexedList array)
toArray.toList array
Result.map f << Err
toErr
Result.andThen f << Err
toErr
Task.map f << Task.fail
toTask.fail
Task.andThen f << Task.fail
toTask.fail
Task.mapError f << Task.succeed
toTask.succeed
Task.onError f << Task.succeed
toTask.succeed
Json.Decode.map f << Json.Decode.fail
toJson.Decode.fail
Json.Decode.andThen f << Json.Decode.fail
toJson.Decode.fail
Maybe.andThen f << Just
tof
Result.andThen f << Ok
tof
Json.Decode.andThen f << Json.Decode.succeed
tof
Random.andThen f << Random.constant
tof
List.concatMap f << List.singleton
tof
Task.andThen f << Task.succeed
tof
Task.onError f << Task.fail
tof
Dict.map f Dict.empty
toDict.empty
Dict.map (\_ value -> value) dict
todict
Dict.filter f Dict.empty
toDict.empty
Dict.filter (\_ _ -> True) dict
todict
Dict.filter (\_ _ -> False) dict
toDict.empty
Dict.remove k Dict.empty
toDict.empty
Dict.foldl f initial Dict.empty
toinitial
(same forDict.foldr
)Dict.foldl (\_ soFar -> soFar) initial dict
toinitial
(same forDict.foldr
)Dict.union dict dict
todict
Dict.intersect dict dict
todict
Tuple.first (List.partition f list)
toList.filter f list
(same forSet.partition
andDict.partition
)List.sum [ a, 0, b ]
toList.sum [ a, b ]
List.product [ a, 1, b ]
toList.product [ a, b ]
List.product [ a, 0, b ]
to0
whenexpectNaN
is not enabledList.product [ a, 0 / 0, b ]
to0 / 0
whenexpectNaN
is enabledList.sum [ a, 0 / 0, b ]
to0 / 0
whenexpectNaN
is enabledList.all identity [ a, False, b ]
toFalse
List.any identity [ a, True, b ]
toTrue
List.all not [ a, True, b ]
toFalse
List.any not [ a, False, b ]
toTrue
List.any identity [ a, False, b ]
toList.any identity [ a, b ]
List.any not [ a, True, b ]
toList.any not [ a, b ]
List.all identity [ a, True, b ]
toList.all identity [ a, b ]
List.all not [ a, False, b ]
toList.all not [ a, b ]
toFloat 1
to1
round 1
to1
ceiling 1
to1
floor 1
to1
truncate 1
to1
round (toFloat n)
ton
(and same for ceiling, floor, truncate)- where
type alias Record = { first : Int, second : Int }
:- all simplifications for
(Record first second)
that already exist for literal records, like(Record first second).first
tofirst
.second << Record first
toidentity
.first << Record first
toalways first
- all simplifications for
List.drop -1 list
tolist
List.drop 3 [ a, b ]
to[]
(same for lists with determined size likeList.singleton
)List.drop 2 [ a, b, c ]
to[ c ]
Maybe.andThen (f << Just) maybe
toMaybe.map f maybe
(same forResult.andThen
,List.concatMap
,Task.andThen
,Task.onError
,Json.Decode.andThen
,Random.andThen
)Test.concat [ test ]
totest
Test.concat [ test0, Test.concat [ test1, test2 ], test3 ]
toTest.concat [ test0, test1, test2, test3 ]
List.concat [ a, List.concat [ b, c ], d ]
toList.concat [ a, b, c, d ]
Platform.Cmd.batch [ a, Platform.Cmd.batch [ b, c ], d ]
toPlatform.Cmd.batch [ a, b, c, d ]
Platform.Sub.batch [ a, Platform.Sub.batch [ b, c ], d ]
toPlatform.Sub.batch [ a, b, c, d ]
String.concat [ a, String.concat [ b, c ], d ]
toString.concat [ a, b, c, d ]
String.concat [ string ]
tostring
String.concat [ string0, "", string1 ]
toString.concat [ string0, string1 ]
Bug fixes:
- Fixed an issue where
Dict.intersect Dict.empty
would be fixed toDict.empty
- Fixed an issue where
Set.intersect Set.empty
would be fixed toSet.empty
- Fixed an issue where
(a |> not) == (b |> not)
would be fixed to(a |> ) == (b |> )
- Fixed an issue where
List.intersperse << List.singleton
would be fixed toList.singleton
- Fixed an issue where e.g.
List.sortBy f << g
would be fixed tog
- Fixed an issue where
Dict.partition (always (always True/False)) dict
would not be reported - Fixed an issue where
List.filterMap f [ a, Nothing, b ]
would be fixed toList.filterMap f [ a, b ]
- Fixed an issue where
Random.map << always
would be fixed toRandom.constant
- Fixed an issue where
List.any (\x -> x == (f x)) list
would be fixed toList.member (f x) list
2.1.2 - 2023-09-28
Lots of new simplifications, especially for Array
and Task
.
The rule now simplifies:
-
Array.fromList []
toArray.empty
-
Array.fromList (Array.toList array)
toarray
-
Array.toList (Array.fromList list)
tolist
-
Array.map f Array.empty
toArray.empty
-
Array.map identity array
toarray
-
Array.indexedMap (\_ value -> f value) array
toArray.map (\value -> f value) array
-
the same operations for
Array.filter
as forList.filter
andSet.filter
-
Array.isEmpty Array.empty
toTrue
-
Array.isEmpty (Array.fromList [ x ])
toFalse
-
Array.repeat 0 n
toArray.empty
-
Array.initialize 0 f
toArray.empty
-
Array.length Array.empty
to0
-
Array.length (Array.fromList [ a, b, c ])
to3
-
Array.length (Array.repeat 3 x)
to3
-
Array.length (Array.initialize 3 f)
to3
-
Array.length (Array.repeat n x)
tomax 0 n
-
Array.length (Array.initialize n f)
tomax 0 n
-
Array.append Array.empty array
toarray
-
Array.append (Array.fromList [ a, b ]) (Array.fromList [ c, d ])
toArray.fromList [ a, b, c, d ]
-
Array.get n Array.empty
toNothing
-
Array.get 1 (Array.fromList [ a, b, c ])
toJust b
-
Array.get 100 (Array.fromList [ a, b, c ])
toNothing
-
Array.get -1 array
toNothing
-
Array.set n x Array.empty
toArray.empty
-
Array.set -1 x array
toarray
-
Array.set 1 x (Array.fromList [ a, b, c ])
toArray.fromList [ a, x, c ]
-
Array.set 100 x (Array.fromList [ a, b, c ])
toArray.fromList [ a, b, c ]
-
Task.andThen f (Task.fail x)
toTask.fail x
-
Task.andThen f (Task.succeed a)
tof a
-
Task.andThen Task.succeed task
totask
-
Task.andThen (\a -> Task.succeed b) task
toTask.map (\a -> b) x
-
Task.onError f (Task.succeed a)
toTask.succeed a
-
Task.onError f (Task.fail x)
tof x
-
Task.onError Task.fail task
totask
-
Task.onError (\x -> Task.fail y) task
toTask.mapError (\x -> y) x
-
Task.sequence [ Task.succeed a, Task.succeed b ]
toTask.succeed [ a, b ]
-
Task.sequence [ Task.succeed a, Task.fail x ]
toTask.fail x
-
Task.sequence [ a, Task.fail x, b ]
toTask.sequence [ a, Task.fail x ]
-
Task.sequence [ task ]
toTask.map List.singleton task
-
Task.map identity task
totask
-
Task.map f (Task.fail x)
toTask.fail x
-
Task.map f (Task.succeed a)
toTask.succeed (f a)
-
Task.map3 f (Task.succeed a) (Task.succeed b) (Task.succeed c)
toTask.succeed (f a b c)
(same for allTask.mapN
functions) -
Task.map3 f (Task.succeed a) (Task.fail x) thirdTask
toTask.fail x
-
Task.map3 f firstTask (Task.fail x) thirdTask
toTask.map2 f firstTask (Task.fail x)
-
Task.mapError identity task
totask
-
Task.mapError f (Task.succeed a)
toTask.succeed a
-
Task.mapError f (Task.fail x)
toTask.fail (f x)
-
List.map f [ a ]
to[ f a ]
-
List.filterMap identity [ a, Nothing, b ]
toList.filterMap identity [ a, b ]
-
List.singleton >> String.fromList
toString.fromChar
-
Result.map3 f (Ok a) (Ok b) (Ok c)
toOk (f a b c)
(same for allResult.mapN
functions) -
Result.map3 f (Ok a) (Err x) thirdResult
toErr x
-
Result.map3 f firstResult (Err x) thirdResult
toResult.map2 f firstResult (Err x)
-
String.append String.empty str
tostr
-
String.append (String.fromList [ a, b ]) (String.fromList [ c, d ])
toString.fromList [ a, b, c, d ]
-
String.fromList [ a, b ] ++ String.fromList [ c, d ]
toString.fromList [ a, b, c, d ]
-
String.fromList (String.toList str)
tostr
-
String.toList (String.fromList list)
tolist
-
String.reverse >> String.reverse
toidentity
-
List.reverse >> List.reverse
toidentity
-
Set.union (Set.fromList [ a, b ]) (Set.fromList [ c, d ])
toSet.fromList [ a, b, c, d ]
-
Set.fromList (Set.toList set)
toset
-
Dict.fromList (Dict.toList dict)
todict
-
Dict.union (Dict.fromList [ a, b ]) (Dict.fromList [ c, d ])
toDict.fromList [ c, d, a, b ]
2.1.1 - 2023-09-18
- A very large number of error messages were reworded to be more consistent, precise and descriptive.
- Checks that applied on
[ a ]
now also report forList.singleton a
(ex:List.concatMap f (List.singleton 1)
gets simplified tof 1
)
The simplification (\x y -> x + y) n m
introduced in 2.1.0 was removed (#147).
The rule now simplifies:
0 // n
to0
n // 0
to0
n // 1
ton
Tuple.first ( a, b )
toa
Tuple.second ( a, b )
tob
Tuple.pair a b
to( a, b )
List.repeat 1 x
toList.singleton x
List.reverse [ x ]
to[ x ]
List.intersperse s [ x ]
to[ x ]
List.concatMap List.singleton x
tox
String.reverse (String.fromChar a)
toString.fromChar a
Dict.intersect Dict.empty dict
toDict.empty
Dict.diff Dict.empty dict
toDict.empty
Dict.diff dict Dict.empty
todict
Dict.union dict Dict.empty
todict
Random.andThen f (Random.constant x)
tof x
Random.andThen Random.constant generator
togenerator
Random.andThen (\a -> Random.constant b) generator
toRandom.map (\a -> b) generator
Random.andThen (always thenGenerator) generator
tothenGenerator
Result.mapError f (if x then Err a else Err b)
tof (if x then a else b)
Random.map identity generator
togenerator
Random.map (always a) generator
toRandom.constant a
Random.map f (Random.constant x)
toRandom.constant (f x)
Random.list 0 generator
toRandom.constant []
Random.list -1/-2/-3/... generator
toRandom.constant []
Random.list 1 generator
toRandom.map List.singleton generator
Random.list n (Random.constant el)
toRandom.constant (List.repeat n el)
Random.uniform a []
toRandom.constant a
Random.weighted ( weight, a ) []
toRandom.constant a
Random.weighted tuple []
toRandom.constant (Tuple.first tuple)
List.member (List.singleton b) b
tob == b
whenexpectNaN
is enabled (and toTrue
otherwise)
Bug fixes:
- Fixed an issue where
Dict.size (Dict.fromList [...])
would be fixed to an incorrect value - Fixed an issue where
Result.toMaybe (if c then Err a else Ok b)
would be fixed toNothing
- Fixed an issue where
Maybe.andThen (always (Just a)) maybe
would be fixed tomaybe
2.1.0 - 2023-08-15
New opt-in configuration option expectNaN
which will disable some simplifications when the user indicates their
project is likely to use NaN
values. This disables the following simplifications:
x == x
toTrue
List.member x [ x ]
toTrue
n * 0
to0
not (a < b)
toa >= b
(similarly for>
,<=
,>=
,==
and/=
)
The rule now simplifies:
List.any ((==) x) list
toList.member x list
List.any (\y -> x == y) list
toList.member x list
n - n
to0
-n + n
to0
0 / n
to0
n * 0
to0
is now autofixed
The rule now reports:
- Immediately invoked anonymous functions
(\x y -> x + y) 1 2
. This is very simplifiable but there is no autofix because there are varied ways to simplify it.- EDIT: This was removed in 2.1.1.
Bug fixes:
- Fixed an issue where
[ [ 1 ], [ 2 ] ] |> List.concat
would be incorrectly fixed and cause a compiler error
Misc:
- Improved error positioning and fixes for errors related to the usage of operators
2.0.33 - 2023-08-13
The rule now simplifies:
a |> f >> g
toa |> f |> g
2.0.32 - 2023-07-11
The rule now simplifies:
List.concat [ a, [], b ]
toList.concat [ a, b ]
2.0.31 - 2023-06-25
Now avoids simplifying String.replace
when the pattern to find contains \r
.
2.0.30 - 2023-06-25
Fixed an issue where String.replace
would be fixed incorrectly (01d3ff)
2.0.29 - 2023-04-17
The rule now simplifies:
Html.Attributes.classList [ x, y, ( z, False ) ]
toHtml.Attributes.classList [ x, y ]
Html.Attributes.classList [ ( onlyOneThing, True ) ]
toHtml.Attributes.class onlyOneThing
Set.fromList [ a ]
toSet.singleton a
Dict.partition f Dict.empty
to( Dict.empty, Dict.empty )
Dict.partition (always True) dict
to( dict, Dict.empty )
Dict.partition (always False) dict
to( Dict.empty, dict )
Result.toMaybe (Ok x)
toJust x
Result.toMaybe (Err e)
toNothing
Result.mapError identity x
tox
Result.mapError f (Ok x)
toOk x
Result.mapError f (Err x)
toErr (f x)
List.map Tuple.first (Dict.toList dict)
toDict.keys dict
List.map Tuple.second (Dict.toList dict)
toDict.values dict
We now also do a better job at figuring what code is the same:
(f >> g) a == (g << f) a
will now be replaced byTrue
.(\f -> List.map f)
is considered equivalent in all simplifications toList.map
(and similarly for a number of other functions).
Bug fixes:
- Fixed an issue where
List.append
would be fixed incorrectly (#105)
2.0.28 - 2023-02-25
- Fixed an issue where errors for
List.foldl
operations would be incorrectly fixed (#86)
2.0.27 - 2023-02-21
- Fixed an issue where
String.fromList [ f x ]
would incorrectly be changed toString.fromChar f x
(#85)
2.0.26 - 2023-02-06
The simplification String.slice 0 n str
-> String.left n str
has been removed because they were not necessarily equivalent. In the case where n
is negative, then the behavior of the 2 functions differ.
The rule now simplifies:
List.member a []
toFalse
List.member a [ a, b, c ]
toTrue
2.0.25 - 2023-02-02
The rule now simplifies:
String.fromList []
to""
String.fromList [ a ]
toString.fromChar a
List.append [] list
tolist
List.head []
toNothing
List.head (a :: bToZ)
toa
List.tail []
toNothing
List.tail (a :: bToZ)
tobToZ
List.sum []
to0
List.sum [ a ]
toa
List.product []
to1
List.product [ a ]
toa
List.minimum []
toNothing
List.minimum [ a ]
toJust a
List.maximum []
toNothing
List.maximum [ a ]
toJust a
List.map2 fn xs []
to[]
(same for up toList.map5
)List.map2 fn [] ys
to[]
(same for up toList.map5
)List.unzip []
to( [], [] )
List.foldl f x (Set.toList set)
toSet.foldl f x set
All the changes in this release were contributed by @lue-bird.
2.0.24 - 2023-01-20
All the changes in this release were contributed by @lue-bird.
The rule now simplifies:
String.slice n n str
to""
String.slice 0 n str
toString.left n str
String.slice n 0 str
to""
String.slice a z ""
to""
String.left 0 str
to""
String.left -1 str
to""
String.left n ""
to""
String.right 0 str
to""
String.right -1 str
to""
String.right n ""
to""
String.slice 2 1 str
to""
String.slice -1 -2 str
to""
List.sortBy (\_ -> a) list
tolist
List.sortBy identity list
toList.sort list
List.sortWith (\_ _ -> LT) list
toList.reverse list
List.sortWith (\_ _ -> EQ) list
tolist
List.sortWith (\_ _ -> GT) list
tolist
The following simplifications for List.sort
also work for List.sortBy fn
and List.sortWith fn
:
List.sort []
to[]
List.sort [ a ]
to[ a ]
The following simplifications for List.foldl also work for List.foldr
:
List.foldl fn x []
tox
List.foldl (\_ soFar -> soFar) x list
tox
List.foldl (+) 0 list
toList.sum list
List.foldl (+) initial list
toinitial + List.sum list
List.foldl (*) 1 list
toList.product list
List.foldl (*) 0 list
to0
List.foldl (*) initial list
toinitial * List.product list
List.foldl (&&) True list
toList.all identity list
List.foldl (&&) False list
toFalse
List.foldl (||) False list
toList.any identity list
List.foldl (||) True list
toTrue
2.0.23 - 2022-11-08
Add better support for jfmengels/elm-review
v2.10.0.
2.0.22 - 2022-11-03
Fixed an issue where 0 - f x
would be simplified to -f x
instead of -(f x)
#52
2.0.21 - 2022-09-06
Fixed an issue in where let declarations would not be fused when there was only a single element in the first let declaration.
2.0.20 - 2022-09-06
The rule now simplifies:
- Applying record access simplification over if and case expressions.
(if condition then
{ record | a = 1 }
else
{ record | field = 2 }
).field
-->
if condition then
{ record | a = 1 }.field
else
{ record | field = 2 }.field
when all patterns can later be simplified. In this example the final result will be
if condition then
record.field
else
2
This also applies to case expressions when all branches can be simplified. Thanks @miniBill! #40
- Simplify case expressions that can be simplified to let variables #48
a =
case value of
{ x, y } ->
1
-->
a =
let
{ x, y } =
value
in
1
- Merging multiple let declarations
let
a = 1
in
let
b = 1
in
a + b
-->
let
a = 1
b = 1
in
a + b
2.0.19 - 2022-08-29
The rule now DOESN'T (it did before) simplify case of expressions where all the branches have the same code when one of the patterns references a custom type from your project. For example
case x of
A -> 1
B -> 1
C -> 1
does not get simplified to 1
like before. But the simplification still happens if the patterns only reference custom
types that come from dependencies or elm/core
, like
case x of
Just _ -> 1
Nothing -> 1
--> 1
The reasoning is that often you want the compiler to give you a reminder when you introduce a new custom type, which this simplification made very hard. It also sometimes created some worse code when you pattern matched on a custom type with only a single constructor.
The configuration setting Simplify.ignoreCaseOfForTypes
now only takes custom types from dependencies. Any type
provided to this function that is not found in the dependencies will now trigger a global error.
It is likely that you won't need this function anymore. If you do, please open an issue because I'd love to know.
A number of elm-review
users didn't use Simplify
because of the simplification above, so I'm hoping that this change will make
you able to use the rule again.
The rule now simplifies:
{ a = 1, b = 2 }.a
to1
. Thanks @miniBill! #35{ foo | b = 1 }.a
tofoo.a
. Thanks @miniBill! #37if a == "a" then if a == "b" then 1 else 2 else 3
toif a == "a" then 2 else 3
2.0.18 - 2022-08-14
Improves the error message for some simplifications.
2.0.17 - 2022-08-14
Removal of unreachable if
branches #31
Simplify
now has the ability to infer values from if conditions, which it will use to simplify boolean expressions and even to remove some if
branches.
if a && b then
if a then -- we know this must be true
1
else -- so we can remove this else
2
else
3
It should also be able to catch things like
if x == 1 then
if x == 2 then -- we know this must be false
...
Note that this will (purposefully) only simplify boolean expressions by what has been inferred from conditions. Therefore, the following will not be simplified. The reasoning behind the decision is that you would not be able to write code like below, which can be useful if you want to rely on top-level constants that you may wish to change at a later point in time.
enableDevMode = False
value =
if enableDevMode then
The rule now simplifies:
(a < b) == (b > a)
toTrue
(a <= b) == (b >= a)
toTrue
(a && b) == (b && a)
toTrue
(a || b) == (b || a)
toTrue
Dict.member x Dict.empty
toFalse
2.0.16 - 2022-07-16
The rule now simplifies:
.field a == a.b
toTrue
a |> fn == fn a
toTrue
fn <| a == fn <| a
toTrue
2.0.15 - 2022-05-05
The rule now simplifies:
List.member x []
toFalse
Set.member x Set.empty
toFalse
List.intersperse x []
to[]
2.0.14 - 2022-04-22
The rule now simplifies:
List.indexedMap f []
to[]
List.indexedMap (\_ value -> f value) list
toList.map (\value -> f value) list
List.indexedMap (always f) list
toList.map f list
2.0.13 - 2022-04-21
The rule now simplifies:
Maybe.andThen (\b -> let y = 1 in Just y) maybe
toMaybe.map (\b -> let y = 1 in y) maybe
Result.andThen (\b -> let y = 1 in Ok y) result
toResult.map (\b -> let y = 1 in y) result
2.0.12 - 2022-04-09
The rule now simplifies:
List.concatMap (\a -> [ b ]) list
toList.map (\a -> b) list
Maybe.andThen (\a -> if condition a then Just b else Just c) maybe
toMaybe.map (\a -> if condition a then b else c) maybe
List.filterMap (\a -> if condition a then Just b else Just c) maybe
toList.map (\a -> if condition a then b else c) maybe
Help would be appreciated to fill the blanks!