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 annotations in patterns #138

Closed
julianhyde opened this issue Apr 6, 2022 · 0 comments
Closed

Type annotations in patterns #138

julianhyde opened this issue Apr 6, 2022 · 0 comments

Comments

@julianhyde
Copy link
Collaborator

julianhyde commented Apr 6, 2022

Allow type annotations in patterns. Examples:

val x: int = 1;
val p: int * bool = (2, true);
val f (x: int) = x + 1;
val g (e: {name: string, deptno: int}) = e.name;

Also in expressions:

1: int;
(2, true): int * bool;
[]: int list;
(1: int) + (2: int);
String.size ("abc": string): int;

And also in function declarations:

fun hello (name: string, code: int): string =
    "hello!";
fun firstOrSecond (e1 :: e2 :: rest): int = e2
  | firstOrSecond (e1 :: rest) = e1;
julianhyde added a commit to julianhyde/morel that referenced this issue Apr 7, 2022
julianhyde added a commit to julianhyde/morel that referenced this issue Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant