-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Wingman removes functions in where clauses during refine hole #2183
Comments
Confirmed. Dang, this looks like it's going to be hard to fix. Nested where doesn't appear to be relevant:
exhibits the same behavior |
Updated the issue - sucks man :( I'm surprised to hear that this is a complicated fix... If you need any help/review let me know and I can try to help |
My guess is that this is a weird interaction between exactprint (which does the AST manipulation for us) and wingman's "agda-split" machinery responsible for splitting |
But also, what SHOULD wingman do here? In the case of binding arguments I guess we can just add them. But what about if there's a case split? bar :: Maybe a -> b
bar ma = _
where
pleaseDontHurtMe = undefined should this split into an explicit case statement rather than a match? Otherwise the |
In the case of a case split, my expected behaviour would be that a case statement is used - but that is a good point, wingman is caught between a rock and a hard place. Otherwise, Wingman could either:
I actually quite like option one personally. I'm the type of person who does single-variable pattern matches with a case of statement, and never via function definition pattern matching (I don't know what that syntax is called). i.e. I prefer:
and I less-prefer
Some problems I foresee would be the Wingman suggestion space outgrowing reason, and implementation difficulty. |
The easiest fix today would be to disable match generation in the presence of a foo :: Int -> Bool
foo = _
where
pleaseDontHurtMe = undefined would produce foo :: Int -> Bool
foo = \n -> _w1
where
pleaseDontHurtMe = undefined It kinda sucks, but it sucks less than trashing the |
Agreed - if it's that an easy fix, that would be my vote also. |
Also, HLint will probably eventually help fix this back to a lambda case anyway. |
Not the best fix, but it's a fix. |
Refine hole on the only hole (
bar = _
)You get:
@isovector why did you hurt my nested where function :(
This might well be an issue with a Wingman dependency, I don't know Wingman's internals well enough to judge...
The text was updated successfully, but these errors were encountered: