GH-196 pattern matching lhs (#210)

* Allow block with separate type signature and definition of a function

For instance,
```
function
  add : (int, int) => int
  add(x, y) = x + y
```

cc #196

* Allow pattern matching in left-hand sides

* Changelog

* Fix type spec

* partial case-on-constructor

* Changelog for pattern-matching lets
This commit is contained in:
Ulf Norell
2020-01-15 09:41:03 +01:00
committed by GitHub
parent f7abaf07fa
commit 4d4a14a9ab
15 changed files with 315 additions and 147 deletions
+3 -1
View File
@@ -40,6 +40,8 @@
| {type_decl, ann(), id(), [tvar()]}
| {type_def, ann(), id(), [tvar()], typedef()}
| {fun_decl, ann(), id(), type()}
| {fun_clauses, ann(), id(), type(), [letbind()]}
| {block, ann(), [decl()]}
| letbind().
-type compiler_version() :: [non_neg_integer()].
@@ -48,7 +50,7 @@
-type letbind()
:: {letval, ann(), pat(), expr()}
| {letfun, ann(), id(), [arg()], type(), expr()}.
| {letfun, ann(), id(), [pat()], type(), expr()}.
-type arg() :: {arg, ann(), id(), type()}.