jfmengels / elm-review-simplify

Provides elm-review rules to simplify your Elm code
https://package.elm-lang.org/packages/jfmengels/elm-review-simplify/latest/
BSD 3-Clause "New" or "Revised" License
20 stars 9 forks source link

Add String.fromList-toList simplifications #182

Closed lue-bird closed 11 months ago

lue-bird commented 11 months ago

Edit: continued in https://github.com/jfmengels/elm-review-simplify/pull/183


String.fromList (String.toList str)
--> str

String.toList (String.fromList list) --> list

-- all below are not in summary String.toList << String.fromList --> identity

String.fromList << String.toList --> identity

String.toList << (String.fromList << f) --> f

(f << String.toList) << String.fromList --> f

String.fromList << (String.toList << f) --> f

(f << String.fromList) << String.toList --> f


and all variations with `<<`/`>>`

Not fully confident that the error messages are easy to understand/read.
jfmengels commented 11 months ago

You have conflicts. If a simple rebase doesn't work, then you need to remove the delete the first four commits:

# Get the latest `main` branch
git checkout <your branch>
git rebase --interactive main
# then remove the first four commits (which are already on `main`)
# Save and exit
git push --force <your branch>
lue-bird commented 11 months ago

It's really strange because running git rebase --interactive upstream/main shows every commit except these 4. I'll try to close this PR and reopen first.

Edit, this worked. See https://github.com/jfmengels/elm-review-simplify/pull/183

jfmengels commented 11 months ago

Hmm, yeah that's weird. I tend to avoid rebasing or doing things compared to remote branches. For instance, I prefer doing things operations relative to main rather than to origin/main, mostly to avoid doing it one way then the other and messing up. Therefore I prefer making that sure main points to the same thing as origin/main.

I'm curious to know the difference it makes in this case :man_shrugging: (but don't go investigating, unless you want to know yourself)