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

Type syntactic sugar ?, |, [], etc ? #213

Closed
dfellis opened this issue Aug 19, 2020 · 1 comment
Closed

Type syntactic sugar ?, |, [], etc ? #213

dfellis opened this issue Aug 19, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@dfellis
Copy link
Member

dfellis commented Aug 19, 2020

The Maybe and Either types currently fill in the blanks on this sort of Typescript-style type system, but Alan's parser could have a simple syntactic sugar of int64? => Maybe<int64> and int64 | float64 => Either<int64, float64>

This would also necessitate parens in the type definition so you can do int64 | float64? => Either<int64, Maybe<float64>> vs (int64 | float64)? => Maybe<Either<int64, float64>>

Similarly, Array<int64> could be written as int64[], and there are probably other shorthand notations we could produce for many of the other built-in generic types. (Eg, HashMap<string, bool> as simply {string: bool}?)

Certainly a lower priority, and not sure if the dual syntaxes for types will make the language more difficult (certainly less regular) but it could make it easier for Typescript, StandardML, etc users to adjust, and definitely makes the types more compact so more complex types can be more easily described.

@dfellis dfellis added the enhancement New feature or request label Nov 11, 2020
@dfellis
Copy link
Member Author

dfellis commented Jun 2, 2024

Alan v0.2 now does this :)

@dfellis dfellis closed this as completed Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant