Early pattern-matching of function parameters
- Dominant language
- OCaml
- Stars
- 45
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
Patterns in formal parameters generate a pattern-matching just after a lambda that binds a parameter. As a result, a function that perform pattern-matching on a parameter cannot be pure. This might be a problem for named or implicit parameters, as they form only pure functions. The following code would not type-check.
```
data U = I
let foo {`x=I} y = y
```
A possible solution to this problem is to delay this pattern-matching until all parameters are taken. Such a behavior is different than in OCaml: assuming non-exhaustive patterns allowed, the following would run correctly, while in OCaml (and the current implementation) it would fail.
```
data T = A | B
let foo A _ = B
let _ = foo B
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.