Closed julianhyde closed 2 years ago
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;
Allow type annotations in patterns. Examples:
Also in expressions:
And also in function declarations: