Skip to content

Add a "Split using NamedFieldPuns" code action #1733

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

Merged
merged 11 commits into from
Apr 16, 2021

Conversation

isovector
Copy link
Collaborator

@isovector isovector commented Apr 15, 2021

@kcsongor requested the ability to transform:

data MyRec = MyRec {a :: Int, b :: Text, c :: Char}
deconstruct :: MyRec -> Int
deconstruct m = _

into

data MyRec = MyRec {a :: Int, b :: Text, c :: Char}
deconstruct :: MyRec -> Int
deconstruct MyRec {a, b, c} = _

This PR adds this functionality under a new code action, available only for values of records. It correctly deals with GADTS and shadowing, opting to use a generated name in the latter case.

@isovector isovector added the merge me Label to trigger pull request merge label Apr 16, 2021
@mergify mergify bot merged commit ef90289 into haskell:master Apr 16, 2021
@isovector isovector deleted the named-field-puns branch May 21, 2021 16:37
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.

2 participants