dotnet / dotnet/fsharp

Code refactoring: single case union deconstruction

Open
#15,673 0 comments 3 reactions 0 assignees View on GitHub
Area-LangService-CodeRefactorings Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Refactor this code:
```fsharp
type CustomerId = CustomerId of id: int

let ProcessCustomerId (cid: CustomerId) =
match cid with
| CustomerId id -> printfn $"{id}"
```

into the following code:
```fsharp
type CustomerId = CustomerId of id: int

let ProcessCustomerId (CustomerId id) =
printfn $"{id}"
```

Thanks @vzarytovskii for the idea.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.