fsharp / fsharp/fsharp.org

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

Offen
#729 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
language-spec
Vorherrschende Sprache
TeX
Sterne
311
Forks
291
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.