Rewrite `[ foo ] ++ bar` to `foo :: bar`?
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
[`elm-analyse`](https://github.com/stil4m/elm-analyse) gives a warning for this situation:
> If you concatenate two lists, but the [left hand side is a single element list literal], then you should use the cons operator.
This seems like not only a stylistic concern, but a performance optimization!
I can't think of any situations where it would be better to write e.g. `[ foo ] ++ anyOtherList` than `foo :: anyOtherList`. Should `elm-format` automatically perform this rewrite?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked elm-analyse warning and elm-format's existing Elm rewrite behavior; the issue names no source file or test. Decide whether rewriting `[ foo ] ++ bar` to `foo :: bar` belongs in elm-format, then confirm the chosen behavior against the Elm Style Guide and formatter output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elm, haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100