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

Code action: switch to record syntax #4391

Open
guibou opened this issue Aug 27, 2024 · 1 comment · May be fixed by #4447
Open

Code action: switch to record syntax #4391

guibou opened this issue Aug 27, 2024 · 1 comment · May be fixed by #4447
Labels
component: hls-explicit-record-fields-plugin Issues related to the hls-explicit-record-fields-plugin type: enhancement New feature or request

Comments

@guibou
Copy link
Collaborator

guibou commented Aug 27, 2024

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

My codebase is full of pieces of record that are constructed using "function" syntax. Something such as:

data Foo = Foo {
   count :: Int,
   name :: String
}

boz = Foo 10 "hello"

Describe the solution you'd like

I would like a code action available on Foo in boz which expand the syntax to record field syntax. Said otherwise, after usage, I would like:

boz = Foo 10 "hello"

to become:

boz = Foo { count = 10, name = "hello" }

Describe alternatives you've considered

Additional context

This can also be extended to other cases where record are used in "function" form, example for pattern matching:

biz (Foo a b) = ...

Could be turned to:

biz (Foo {count = a, name = b}

If you are interested and if the initial design is ok, I can give a try to the implementation.

@michaelpj
Copy link
Collaborator

Definitely desirable!

I think this would be nice if it was done in combination with #4212, since it should be mostly the same code?

@fendor fendor added component: hls-explicit-record-fields-plugin Issues related to the hls-explicit-record-fields-plugin and removed status: needs triage labels Sep 18, 2024
@jetjinser jetjinser linked a pull request Nov 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-explicit-record-fields-plugin Issues related to the hls-explicit-record-fields-plugin type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants