-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
server: add hlint hints to replace case analysis with combinators #6145
Conversation
-- | Efficiently coerce a set from one type to another. | ||
-- | ||
-- This has the same safety properties as 'Set.mapMonotonic', and is equivalent | ||
-- to @Set.mapMonotonic coerce@ but is more efficient. This is safe to use when | ||
-- both @a@ and @b@ have automatically derived @Ord@ instances. | ||
-- | ||
-- https://stackoverflow.com/q/57963881/176841 | ||
coerceSet :: Coercible a b=> Set.Set a -> Set.Set b | ||
coerceSet = unsafeCoerce | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is removed from here. Is this change relevant to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not relevant. Would you rather see this change be merged separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's just dead code removal. It's fine this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check that Pro doesn't use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicuveo According to some quick grep
s, it's not used by pro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, then. LGTM! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no cl required
Description
This PR implements 8 new hlint hints that enforce usage of our
onNothing
andonLeft
combinators. Thus it further improves on #6126. Example hints provided by these new hlint hints:These new hints are triggered 23 times on the current master codebase.
This PR also removes some dead code, namely
coerceSet
, fromHasura.Prelude
.Affected components