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 -4
View File
@@ -8,10 +8,9 @@ contract Stack =
entrypoint init(ss : list(string)) = { stack = ss, size = length(ss) }
function length(xs) =
switch(xs)
[] => 0
_ :: xs => length(xs) + 1
function
length([]) = 0
length(_ :: xs) = length(xs) + 1
stateful entrypoint pop() : string =
switch(state.stack)