mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-19 06:17:33 +03:00
add softhang test
This commit is contained in:
parent
0b49f58fc5
commit
6abc044bde
@ -701,6 +701,41 @@ ex3a =
|
||||
.> load roundtrip.u
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> undo
|
||||
```
|
||||
|
||||
# Use soft hangs after `with` and in last argument of function application
|
||||
|
||||
```unison:hide roundtrip.u
|
||||
structural ability Abort where
|
||||
abort : x
|
||||
|
||||
ex1 = handle
|
||||
x = 1
|
||||
y = abort
|
||||
x + y
|
||||
with cases
|
||||
{ a } -> a
|
||||
{ Abort.abort -> _ } -> 0
|
||||
|
||||
List.foreach x f = 0
|
||||
|
||||
ex2 = List.foreach [0,1,2,3,4,5] cases
|
||||
0 -> 0
|
||||
1 -> 1
|
||||
n -> n + 100
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> edit ex1 ex2
|
||||
.> load roundtrip.u
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> undo
|
||||
```
|
@ -536,8 +536,8 @@ x = '(let
|
||||
|
||||
handler : a -> Request {Abort} a -> a
|
||||
handler default = cases
|
||||
{ a } -> a
|
||||
{abort -> _} -> default
|
||||
{ a } -> a
|
||||
{ abort -> _ } -> default
|
||||
|
||||
x : 'Optional Nat
|
||||
x =
|
||||
@ -1277,9 +1277,9 @@ bar3 x = do
|
||||
bar2 x = do
|
||||
a = 1
|
||||
b = 2
|
||||
1 + (foo a do
|
||||
1 + (foo a (do
|
||||
c = 3
|
||||
a + b)
|
||||
a + b))
|
||||
|
||||
bar3 : x -> () -> b -> Nat
|
||||
bar3 x = do
|
||||
@ -1949,3 +1949,65 @@ ex3a =
|
||||
file has been previously added to the codebase.
|
||||
|
||||
```
|
||||
# Use soft hangs after `with` and in last argument of function application
|
||||
|
||||
```unison
|
||||
---
|
||||
title: roundtrip.u
|
||||
---
|
||||
structural ability Abort where
|
||||
abort : x
|
||||
|
||||
ex1 = handle
|
||||
x = 1
|
||||
y = abort
|
||||
x + y
|
||||
with cases
|
||||
{ a } -> a
|
||||
{ Abort.abort -> _ } -> 0
|
||||
|
||||
List.foreach x f = 0
|
||||
|
||||
ex2 = List.foreach [0,1,2,3,4,5] cases
|
||||
0 -> 0
|
||||
1 -> 1
|
||||
n -> n + 100
|
||||
|
||||
```
|
||||
|
||||
|
||||
```ucm
|
||||
.> edit ex1 ex2
|
||||
|
||||
☝️
|
||||
|
||||
I added these definitions to the top of
|
||||
/Users/pchiusano/unison/roundtrip.u
|
||||
|
||||
ex1 : Nat
|
||||
ex1 =
|
||||
handle
|
||||
use Nat +
|
||||
x = 1
|
||||
y = abort
|
||||
x + y
|
||||
with cases
|
||||
{ a } -> a
|
||||
{ abort -> _ } -> 0
|
||||
|
||||
ex2 : Nat
|
||||
ex2 =
|
||||
foreach [0, 1, 2, 3, 4, 5] cases
|
||||
0 -> 0
|
||||
1 -> 1
|
||||
n -> n Nat.+ 100
|
||||
|
||||
You can edit them there, then do `update` to replace the
|
||||
definitions currently in this namespace.
|
||||
|
||||
.> load roundtrip.u
|
||||
|
||||
I found and typechecked the definitions in roundtrip.u. This
|
||||
file has been previously added to the codebase.
|
||||
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user