Skip to content

Code action: switch to record syntax #4391

Closed
@guibou

Description

@guibou

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions