-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Feature Request: Case-split QuickFix on pattern argument #1643
Comments
Yeah, I've been thinking about this. The backend machinery is all in place (except for at patterns, which have a TODO); the hardest part is getting the code action to come up on the pattern binding. |
I don't plan to tackle this anytime soon. But if someone wanted to send a PR that changed this: haskell-language-server/plugins/hls-tactics-plugin/src/Wingman/LanguageServer.hs Lines 165 to 169 in d60dee0
to work on things that aren't holes, and then figure out which bit of this needs to change: haskell-language-server/plugins/hls-tactics-plugin/src/Wingman/LanguageServer.hs Lines 137 to 143 in d60dee0
then I'd be happy to push through the rest of the work. |
Relatedly, @kcsongor suggests: don’t know if this is wingman related, but something I quite often wish I could do with a code action is this: foo (Foo a b c) = pure a apply code action -> foo (Foo a _b _c) = pure a 2:50 foo (Baz a b c) = () here, the important thing is that none of the bound variables are actually used. What I do in this situation is rewrite the pattern to the following: foo Baz {} = () which I prefer to Baz _a _b _c because it’s more resilient to extending the constructor - I would love to have a code action that can do this foo Baz {} = () I change my mind and want to bind stuff from Baz : foo (Baz a b c) = () 2:54 |
As reported in #1602, typed holes make typechecking significantly slower.
It might be good if we can invoke the powerful Wingman without using holes if possible.
I think one such example is
case split
tactic. Consider the following:I think we can provide
Case split on may
onmay
in Line 2.One thing that we must think is the treatment of the function body.
If the function body is mere typed hole
_
, we can copy them as-is.If the
...
part contains some other contents, we have a few options:may
.may
with destructed value.may@(Just mayj)
.may
.The text was updated successfully, but these errors were encountered: