elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 656 forks source link

allow `{ RecordAlias | extraField : ... }` #2209

Closed lue-bird closed 3 years ago

lue-bird commented 3 years ago
{ RecordAlias | extraField : () }

type alias RecordAlias =
    {} -- any record (alias)

doesn't compile:

I just started parsing a record type, but I got stuck here:

{ TypeAlias | extraField : () }
  ^

Record types look like { name : String, age : Int }, so I was expecting to see a field name next.

It works with a type variable:

type alias WithExtraField a =
    { a | extraField : () }

WithExtraField RecordAlias

Unless not being able to write a type like in the first line is intentional, elm should allow this syntax to be more consistent.

github-actions[bot] commented 3 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.