Skip to content
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

Case splitting features #323

Closed
pepeiborra opened this issue Aug 16, 2020 · 13 comments · Fixed by #391
Closed

Case splitting features #323

pepeiborra opened this issue Aug 16, 2020 · 13 comments · Fixed by #391
Labels

Comments

@pepeiborra
Copy link
Collaborator

Original Twitter threads: https://twitter.com/Anka213/status/1289724597735063552

Case splitting an equation (in Idris):

idris

How this could be implemented in HLS:

  • A code action provider to split equations with an empty rhs
  • A completion provider with splitting suggestions for case [..] of

Tools that already do this:

@jneira
Copy link
Member

jneira commented Aug 16, 2020

Just in case the references can help, the feature was included in hie (afaik using ghc-mod underneath and using hare by @Avi-D-coder): haskell/haskell-ide-engine#907

@isovector
Copy link
Collaborator

@TOTBWF and are tackling this (and other great things!)

@isovector
Copy link
Collaborator

Peek 2020-09-07 16-46

It's looking really good! We want to get a little more code automation in before opening a PR.

@pepeiborra
Copy link
Collaborator Author

Wow, that looks fabulous!

@isovector
Copy link
Collaborator

isovector commented Sep 9, 2020

Blocked by alanz/ghc-exactprint#91, since it prevents us from to synthesize new terms that respect layout.

@pepeiborra
Copy link
Collaborator Author

Blocked by alanz/ghc-exactprint#91, since it prevents us from to synthesize new terms that respect layout.

Oh no! Please share the ghcide/HLS branch and maybe someone can find a workaround.

@isovector
Copy link
Collaborator

@pepeiborra sure! I will be forever in your debt if you can. https://github.com/isovector/haskell-language-server/tree/tactics

Everything is hooked up and working, but TreeTransform (which uses ExactPrint) runs into this issue when trying to insert the generated terms back into the source.

@aryairani
Copy link

Should we reopen this for the latest version? (:

@pepeiborra
Copy link
Collaborator Author

@santiweight is already working on this, by reviving tactics to work with 9.x and beyond

@isovector
Copy link
Collaborator

We're in a bit of a weird situation here; I was planning on picking up the work from @santiweight due to a possible contract for this feature, but it didn't end up coming through. The work necessary to port things to 9.2 is hairy and thankless and I'm not particularly keen to push it through --- especially without a plan for how we can prevent breakage of this sort in the future. It's not a situation I love, but it is what it is.

@santiweight
Copy link
Collaborator

santiweight commented Sep 15, 2022

Unfortunately for myself I'm a little too keen to get it done! We have the case splitting functionality completely ported now, and passing all tests.

I would like to port the tactics functionality and I expect it will be possible. I will try my best over time to get it done: as Sandy says, it's quite hairy and opaque. Thankfully, I am now quite comfortable with the new exactprint api. The main thing I have left to learn is all of Sandy's fancy judgment features!

I think I now have enough knowledge to get the job finished :)

@santiweight
Copy link
Collaborator

Wrt to breakage in the future: I agree totally. It gives me a little anxiety... However, the new API, while hard to learn, is quite productive and understandable. As far as I know, this is the only planned change to the exact print infrastructure for the foreseeable future, and so I'm allowing myself to take the risk this time.

@MangoIV
Copy link

MangoIV commented May 18, 2024

heya! can we expect that this will come back to hls? is there work being done or tracked elsewhere?
I would be happy if it came independently of a tactics plugin, just being able to case split would be awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants