compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Clarify type syntax

Open pravdomil opened this issue 1 year ago • 3 comments

Since type can only define sum(or) type let's use type or keyword instead, to make it explicit.

Or maybe:

And type - zero and more values type alias Or type - zero and more variants type or Opaque type - basically wrapper around one value type opaque

pravdomil avatar Sep 09 '23 12:09 pravdomil

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

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

github-actions[bot] avatar Sep 09 '23 12:09 github-actions[bot]

To me it seems somewhat confusing to call single-variant types "or":

type or Email
    = Email { local : Local, domain : Domain }

lue-bird avatar Sep 09 '23 12:09 lue-bird

that is how it works now, it it still an or type with one variant

but that is another topic: if or type can have only one variant

I would suggest following:

And type - zero and more values type alias Or type - zero and more variants type or Opaque type - basically wrapper around one value type opaque

That also solves a problem how data should be serialized into text/binary format.

Now, it is not clear if: Or type with one variant should be treated as just the value or variant index and the value.

pravdomil avatar Sep 09 '23 13:09 pravdomil