Closed JoeyEremondi closed 8 years ago
No, it's not implemented at the moment, and yes, I can do that.
Sorry it took so long.
Are you doing this via ghc-mod legacy-interactive
or a separate ghc-mod invocation? There is a bug in all currently released versions that will break case splitting when you use check
in the same session as case-split
iirc.
Former. But that should be relatively easy to change.
I do however occasionally run into Prelude.head: empty list
crash with case split with master.
You can change it back to interactive after the next release it's just a workaround. As for that empty list crash I haven't seen that before. I see like four usages of head
in CaseSplit.hs and some in FillSig.hs. We should probably replace them with headNote so we can identify which one is failing.
Selecting fromJust and invoking a command should import Data.Maybe, and there should be an option to automatically resolve not-in-scope errors by importing (and automatically remove unused imports). (Make sure not to let it move the line the cursor is on relative to the screen.)
@Gurkenglas, that is not possible in general case. Auto-imports are available, although those are work-in-progress. In any case, this is unrelated. In the future, please file separate issues.
@DanielG, apparently, it's this one: https://github.com/DanielG/ghc-mod/blob/master/Language/Haskell/GhcMod/CaseSplit.hs#L214
This happens primarily with stupid cases, e.g.
test :: Maybe a
test x = _body
Running case split on x
will crash ghc-mod then.
Can you make a testcase so we can track this crash?
Um. Sure. Should I add it to case-split tests with a PR then?
Sure.
This was my favorite feature when using ghc-mod with emacs: being able to put the cursor over a variable in a case-split, do M-t, and have it create the pattern match for me with all the possible constructors.
Is this currently possible with atom? If not, consider this a feature request in what's already a pretty great package.
Thanks!