Expressions returning only Just _ : Maybe a
-> convert to return a
instead
#89
Janiczek
started this conversation in
Rule ideas
Replies: 1 comment
-
If this rule is just checking that all the branches in an expression end with the same custom type variant, maybe it could be generalize to handle other Ok, Err, and user defined custom type variants as well? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What the rule should do:
Check all returned expressions inside
if...else
andcase...of
expressions of typeMaybe _
for whether they're allJust
s.In that case it should suggest that you change it to instead return the values inside the
Just
s and (perhaps?) call theJust
constructor outside (or refactor the usages of this expression/function to something nicer / more idiomatic).Example of things the rule would report:
⬇️
or
⬇️
Example of things the rule would not report:
When (not) to enable this rule:
Libraries might be bound by their existing API design and so it might not be desirable to refactor such functions to stop exposing
Maybe
.I am looking for:
Beta Was this translation helpful? Give feedback.
All reactions