Case split plugin - #5014
Conversation
|
Everybody is eagerly anticipating this change, thank you! Given the many WIP commits, I just wanted to ask if you could sqaush or reword them. I guess you had this in mind anyways. |
Glad to hear that!
Yep, see 3rd paragraph at the top :P |
|
Ah, the second sub-clause :-P my attention had already shifted before that one, I apologize :-)! Thanks! |
5456d10 to
038348b
Compare
MangoIV
left a comment
There was a problem hiding this comment.
First pass. I think after you clean up the main logic a bit more and add some documentation there, I can take another look. :)
Very good work, looking forward to having this in HLS!
| pure (old, new) | ||
|
|
||
| where | ||
| go :: forall d m. (MonadState Bool m, MonadReader Bool m, Data d) => d -> m d |
There was a problem hiding this comment.
You can use for instance ExceptT for now. Is it clear why that's better?
And if you want to, you can try
newtype ExceptCT e m a
= MkExceptC {unExceptCT :: forall b. (e -> m b) -> (a -> m b) -> m b} and see if that's faster. But that doesn't have to be done now.
e8152da to
9d9f1ff
Compare
11c2716 to
5ea6895
Compare
This PR is for introducing the so called case-split plugin, as requested in #5013.
(In the following, me is myself and we is myself, @fendor, @MangoIV, and @AndreasPK.)
The change as of now needs lots of refinements (obviously beside getting rid of all the
trace*calls I've peppered the code with, and beside squashing all commits together), especially these:maxUncoveredPatternsuncovered patterns, but the plugin would nonetheless insert _all_¹ uncovered patterns;maxUncoveredPatterns, because it's the least invasive approach, it doesn't require any additional code, one can only improve from there, and nothing prevents the user from triggering the plugin more than once to uncover more and more patterns (as noticed by Andreas, this could actually be the gist of some solution to the whole problem, i.e. trigger the plugin repeatedly until no uncovered pattern remains);T16.hs), the indentation of the patterns inserted by the plugins is sometimes too much, although correct,deltaPosand related abstractions work; need to chat with @alanz about this;\casejust as it does forcase(seeT12.hs), but maybe this is as much a generalization as having the plugin work with function definitions, so I guess we can drop this test, or maybe assume it as failing and link a new enhancement request to it?_, but the test doesn't pass (seeT18.hs); I still don't know why;T19.hs? I think it should just not offer any action.caseexpressions, both incomplete, are nested (e.g.T14.hs), the plugin shouldoffer an action for each incompletetrigger for the innermostcasecaseexpression which the cursor is on;->or its unicode counterpart, honoring the-XUnicodeSyntaxflag or previous patterns.¹ Not really all, we don't want to split an all
Ints, for instance, nor on an actualdatawith 100 ctors, presumably. Or do we?