fsharp / fsharp/fsharp.org

Possibly wrong pattern for `union-type-case-data` in spec

Aperta
#729 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
language-spec
Lingua principale
TeX
Stelle
311
Fork
291
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.