镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Proposal: Vertical bar before discriminated unions #13781

Description

@ErikCupal

If we want to align discriminated unions vertically, we can write them like this

type Action =
    Increment |
    Decrement |
    Reset

// or

type Action =
    Increment 
    | Decrement 
    | Reset

It doesn't look bad, but it can be quite annoying to check if the bars are at right places when you want to add new types at the beginning or at the end or when you want to reorginize them - basically the same issue as trailing commas.

What I would love to have is this:

type Action =
    | Increment 
    | Decrement 
    | Reset

It is easier to read and easier to maintain.

Activity

  1. changed the title [-]Proposal: Allow vertical bar before discriminated unions[/-] [+]Proposal: Vertical bar before discriminated unions[/+] on Jan 31, 2017
  2. normalser commented on Jan 31, 2017

    @normalser
  3. ErikCupal commented on Jan 31, 2017

    @ErikCupal
    Author

    Ah, sorry, I'm closing it

  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions