Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Split all function arguments" code action (#1464)
* Add DestructAll tactic * Don't use guard in IO Missing features were accidentally blocking all code actions * Write a better provider and add tests * Haddock Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
76dadaa
commit 73daeaa
Showing
11 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
and :: Bool -> Bool -> Bool | ||
and x y = _ |
5 changes: 5 additions & 0 deletions
5
plugins/hls-tactics-plugin/test/golden/DestructAllAnd.hs.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
and :: Bool -> Bool -> Bool | ||
and False False = _ | ||
and True False = _ | ||
and False True = _ | ||
and True True = _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data ABC = A | B | C | ||
|
||
many :: () -> Either a b -> Bool -> Maybe ABC -> ABC -> () | ||
many u e b mabc abc = _ |
27 changes: 27 additions & 0 deletions
27
plugins/hls-tactics-plugin/test/golden/DestructAllMany.hs.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
data ABC = A | B | C | ||
|
||
many :: () -> Either a b -> Bool -> Maybe ABC -> ABC -> () | ||
many () (Left a) False Nothing A = _ | ||
many () (Right b5) False Nothing A = _ | ||
many () (Left a) True Nothing A = _ | ||
many () (Right b5) True Nothing A = _ | ||
many () (Left a6) False (Just a) A = _ | ||
many () (Right b6) False (Just a) A = _ | ||
many () (Left a6) True (Just a) A = _ | ||
many () (Right b6) True (Just a) A = _ | ||
many () (Left a) False Nothing B = _ | ||
many () (Right b5) False Nothing B = _ | ||
many () (Left a) True Nothing B = _ | ||
many () (Right b5) True Nothing B = _ | ||
many () (Left a6) False (Just a) B = _ | ||
many () (Right b6) False (Just a) B = _ | ||
many () (Left a6) True (Just a) B = _ | ||
many () (Right b6) True (Just a) B = _ | ||
many () (Left a) False Nothing C = _ | ||
many () (Right b5) False Nothing C = _ | ||
many () (Left a) True Nothing C = _ | ||
many () (Right b5) True Nothing C = _ | ||
many () (Left a6) False (Just a) C = _ | ||
many () (Right b6) False (Just a) C = _ | ||
many () (Left a6) True (Just a) C = _ | ||
many () (Right b6) True (Just a) C = _ |
12 changes: 12 additions & 0 deletions
12
plugins/hls-tactics-plugin/test/golden/DestructAllProvider.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- we need to name the args ourselves first | ||
nothingToDestruct :: [a] -> [a] -> [a] | ||
nothingToDestruct = _ | ||
|
||
|
||
-- can't destruct all for non-top-level holes | ||
notTop :: Bool -> Bool -> Bool | ||
notTop a b = a && _ | ||
|
||
-- destruct all is ok | ||
canDestructAll :: Bool -> Bool -> Bool | ||
canDestructAll a b = _ |