Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify case if all branches are the same #292

Open
miniBill opened this issue Mar 4, 2024 · 3 comments
Open

Simplify case if all branches are the same #292

miniBill opened this issue Mar 4, 2024 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@miniBill
Copy link
Contributor

miniBill commented Mar 4, 2024

What the rule should do:
Simplify case of expressions if all the branches are the same.

Example of things the rule would report:

 case err of
   Http.BadBody _ ->
    Task.fail err
  _ ->
    Task.fail err
--> Task.fail err

(this is real code, and is the result of other simplifications)

Example of things the rule would not report:

case res of
  Ok v -> v
  Err v -> v

Should this be part of the Simplify rule or should it be a new rule?
Should be part of Simplify

I am looking for:

  • Feedback
  • Someone to implement it with/for me
@jfmengels
Copy link
Owner

This is something that we did earlier in the history of the rule and was (partially) removed in v2.0.19 (reasoning in the link). Let me know what you think.

@miniBill
Copy link
Contributor Author

miniBill commented Mar 4, 2024

Ah, makes sense. It should have triggered though, because Http.BadBody comes from a dependency?

@jfmengels
Copy link
Owner

You're correct 🤔
I'll mark this as a bug, this will need some looking into.

@jfmengels jfmengels added bug Something isn't working help wanted Extra attention is needed labels Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants