haskell / haskell/haskell-language-server

Simpler Tier 1 tactics for case splits

Open
#3,525 8 comments 3 reactions 0 assignees View on GitHub
component: wingman type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

## Is your enhancement request related to a problem? Please describe.

First, let me say that I appreciate all of the hard work the maintainers of HLS and plugins do and have done - you guys are superheroes!

It looks like `hls-tactics-plugin` has been disabled due to some conflict with GHC 9.2 that has not been resolved. This means that features like case splitting are no longer available in HLS. I am probably not along in having become very used to this feature, as it allows one to destruct large sum types quickly. In my opinion, this tactic should be a Tier 1 feature of HLS, at least for "simple" types (ADTs, maybe not GADTs). It would be great to see it re-enabled, but it seems like the machinery of the `tactics` plugin is a bit daunting for new contributors! It has support for type-directed program synthesis that may not be needed for simple tactics such as destruct (but please correct me if I am wrong).

## Describe the solution you'd like

I propose a separate plugin that supports the simplest tactics like destruct and intros, and only on simple types. Ideally we would get it into a state where enough people would feel comfortable with maintenance that it could be a Tier 1 plugin. Doing this might be a good opportunity to pull out some reusable functionality that can be shared between tactics implementations and other plugins. (For example, right now `tactics` relies on `refactor` for printing and insertion.) Such reusable functionality might include:

* Identifying whether a code action may have a relevant hole (for example, when invoking quick-fix on a var on the LHS of a function definition with a hole in the body on the RHS).
* Identifying the type of the var under the point, or identifying the type of the relevant hole.
* Classifying which types can be easily destructed.
* Generating fresh (and relevant) names for pattern vars and named holes.
* Generating patterns from easily-destructible types
* Inserting generated syntax into the document.

(I know where some of this functionality is, but it's not easy to find and isolate! Documentation may help.)

The `tactics` plugin could then be focused on more advanced program synthesis.

## Describe alternatives you've considered

The alternative is the status quo, where `tactics` may disappear in HLS releases as it is not Tier 1. Additional maintainers could change that, though. Improved documentation of the `tactics` plugin would also help.

## Additional context

I am happy to contribute what I can, but I definitely need some help. I am also happy to try to break down and organize tasks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.