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

Add "Split all function arguments" code action #1464

Merged
merged 6 commits into from Mar 1, 2021

Conversation

isovector
Copy link
Collaborator

Another hot feature requested by @TOTBWF. This PR adds a new code action that performs a case split on all bound function arguments. For example, given:

and :: Bool -> Bool -> Bool
and = _

it will produce

and :: Bool -> Bool -> Bool
and False False = _
and True False = _
and False True = _
and True True = _

@isovector isovector added the merge me Label to trigger pull request merge label Mar 1, 2021
@googleson78
Copy link
Contributor

A more modular approach taken in Agda is to be able specify which arguments to split on in the hole (or prompt the user to input them). So for Haskell it might look something like

f x y z = _x_y
-- case split action results in all the cases for x and y only

Not sure if we have hole info though, and if the "advanced hole info stuff" by @Tritlo even is merged in ghc.

@mergify mergify bot merged commit 73daeaa into haskell:master Mar 1, 2021
@isovector isovector deleted the split-all branch March 1, 2021 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants