The reason why we have this for Set and Array but not for Dict, is because the fold functions for Dict take an additional argument, which requires changes potentially far away. This is however easily resolvable when the fold function is an anonymous function:
When using Dict.keys:
dict
|> Dict.keys
|> List.foldl (\key acc -> ...) x
-->
dict
|> Dict.foldl (\key _ acc -> ...) x
When using Dict.values:
dict
|> Dict.values
|> List.foldl (\value acc -> ...) x
-->
dict
|> Dict.foldl (\_ value acc -> ...) x
(if List.foldr is used, then we would use Dict.foldr instead)
Similar to changes like the one introduced in https://github.com/jfmengels/elm-review-simplify/pull/76, but for Dict.
The reason why we have this for
Set
andArray
but not forDict
, is because the fold functions forDict
take an additional argument, which requires changes potentially far away. This is however easily resolvable when the fold function is an anonymous function:When using
Dict.keys
:When using
Dict.values
:(if
List.foldr
is used, then we would useDict.foldr
instead)