-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
List.member on Dict.keys/Set.toList -> Dict/Set.member #290
Comments
Nice. So basically we can only apply these if the set/dict is constructed right there ( (And I think you mean |
Ah, yes. That seems (unfortunately) correct. Those restrictions seems to make this rule pretty niche, so I don't think it is worth to implement it probably. |
Sounds like a good idea 👍 I wonder if there are other conversations (for instance |
I think these are not supported. .singletonDict.fromList (List.singleton (k,v)) List.length ✅ #293List.length (Set.toList set) -- also for Dict.keys and Dict.values List.isEmpty ✅ #293-- also for Dict.keys and Dict.values List.isEmpty (Set.toList set) List.member (both of these have the same problems as the one above :()List.member k (Dict.keys dict) List.member k (Set.toList set) |
What the rule should do:
Replace List.member on Set.toList/Dict.keys with Set/Dict.member
What problems does it solve:
Simplifying and optimizes unnecessary convertions
Example of things the rule would report:
Example of things the rule would not report:
Since Set/Dict.member requires comparable, but List.member does not,
applying this replacement to Set/Dict.empty, could lead to a type error.
So therefore we should/could not replace it in that case. (But it should be caught by some other simplification rule)
The above should be simplified to
False
anyways, by the callOnEmptyReturnsCheckShould this be part of the Simplify rule or should it be a new rule?
Part of Simplify
I am looking for:
The text was updated successfully, but these errors were encountered: