Closed jfmengels closed 9 months ago
IMO this is subjective and code style related, not removing complexity/simplifying.
document : Browser.Document
document =
{ ... body =
some
|> ui
|> Element.layout []
|> List.singleton
}
which is conceptually different in my mind compared to List.map f [ x ] --> [ f x ]
which removes complexity (operate on data directly, not on the wrapped data).
In my mind, this exactly like the debate about always
vs \_ ->
: Something that is best configured in a separate rule if you have a particular preference.
I do not feel as strongly about the case where List.singleton
is applied, not piped, but fixing only that case will feel inconsistent and random, so I'd prefer not to add it.
This is a lot more idiomatic Elm code.
I don't know if we should so in the case of pipelines
but I feel like it will end up bringing more clarity to the code maybe? I've had similar push-backy thoughts on other simplifications (
List.map f [ x ]
-->[ f x ]
) but in the end the results did feel nicer, so I think we should do it.What do you think?