Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add a "Split using NamedFieldPuns" code action #1733

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
# for free to join this conversation on GitHub. Already have an account? # 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