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

Possibly wrong pattern for union-type-case-data in spec #729

Open
Szer opened this issue Apr 24, 2018 · 0 comments
Open

Possibly wrong pattern for union-type-case-data in spec #729

Szer opened this issue Apr 24, 2018 · 0 comments

Comments

@Szer
Copy link

Szer commented Apr 24, 2018

On a page 139 (8. Type definition) possible union cases listed as follow:

union-type-case-data := 
    ident --null union case
    ident of union-type-field * ... * union-type-field --n-ary union case
    ident : uncurried-sig --n-ary union case

uncurried-sig :=
    args-spec -> type

args-spec :=
    arg-spec * ... * arg-spec

But this one doesn't compile:

type Test =
    | A
    | B of int*int
    | C : int->int

with error:

Return types of union cases must be identical to the type being defined, up to abbreviations
This construct is deprecated: it is only for use in the F# library

But this one is correct:

type Test =
    | A
    | B of int*int
    | C of (int->int) //parentheses are required

So probably union-type-case-data should look like:

union-type-case-data := 
    ident --null union case
    ident of union-type-field * ... * union-type-field --n-ary union case
    ident of (uncurried-sig) --n-ary union case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants