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

フィールドの型から判別共用体のケースを推論する #22

Open
hafuu opened this issue Mar 20, 2015 · 0 comments
Open

Comments

@hafuu
Copy link
Collaborator

hafuu commented Mar 20, 2015

[<値の型が違えば名前は省略できる属性>]
type t = Hoge of int | Piyo of string
- 1      # Hoge
- "piyo" # Piyo

[<値の型が違えば名前は省略できる属性>]
// 要素の順番で解決する
type t = Hoge of int * string | Piyo of string list
- [ 1, "hoge" ]   # Hoge
- [ "2", "piyo" ] # Piyo

[<値の型が違えば名前は省略できる属性>]
type t = Hoge of int * string | Piyo of int * int * int
- [ 1, "hoge" ] # Hoge
- [ 1, 2, 3 ]   # Piyo

[<値の型が違えば名前は省略できる属性>]
type t = Hoge of int list | Piyo of string list
- [ 1, 2, 3 ]
- [ "a", "b", "c" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant