update transcripts

This commit is contained in:
Paul Chiusano 2022-12-01 23:51:11 -06:00
parent bd8b2a9af0
commit 685a202319
27 changed files with 53 additions and 52 deletions

View File

@ -9,6 +9,7 @@ compose2 f g = a -> b -> f (g a b)
compose3 f g = a -> b -> c -> f (g a b c)
id a = a
void x = ()
structural ability Exception where
raise: io2.Failure -> anything

View File

@ -13,12 +13,12 @@ tested here.
```unison
test1 : '{IO, Exception} [Result]
test1 = do
fromUtf8 0xsee
_ = fromUtf8 0xsee
[Ok "test1"]
test2 : '{IO, Exception} [Result]
test2 = do
tryEval '(bug "whoa")
_ = tryEval '(bug "whoa")
[Ok "test2"]
```

View File

@ -9,12 +9,12 @@ tested here.
```unison
test1 : '{IO, Exception} [Result]
test1 = do
fromUtf8 0xsee
_ = fromUtf8 0xsee
[Ok "test1"]
test2 : '{IO, Exception} [Result]
test2 = do
tryEval '(bug "whoa")
_ = tryEval '(bug "whoa")
[Ok "test2"]
```

View File

@ -15,7 +15,7 @@ tests _ =
[ catcher do
match None with Some x -> x
, catcher do
1/0
_ = 1/0
()
, catcher '(bug "testing")
, handle tryEval (do 1+1) with cases

View File

@ -11,7 +11,7 @@ tests _ =
[ catcher do
match None with Some x -> x
, catcher do
1/0
_ = 1/0
()
, catcher '(bug "testing")
, handle tryEval (do 1+1) with cases

View File

@ -8,7 +8,7 @@ functions.
```unison
Stream.fromList : [a] -> '{Stream a} ()
Stream.fromList l _ =
List.map (x -> emit x) l
_ = List.map (x -> emit x) l
()
Stream.map : (a -> b) -> '{Stream a} r -> '{Stream b} r

View File

@ -4,7 +4,7 @@ functions.
```unison
Stream.fromList : [a] -> '{Stream a} ()
Stream.fromList l _ =
List.map (x -> emit x) l
_ = List.map (x -> emit x) l
()
Stream.map : (a -> b) -> '{Stream a} r -> '{Stream b} r

View File

@ -137,8 +137,8 @@ testTcpConnect = 'let
toSend = "12345"
forkComp (serverThread portVar toSend)
forkComp (clientThread portVar resultVar)
void (forkComp (serverThread portVar toSend))
void (forkComp (clientThread portVar resultVar))
received = take resultVar

View File

@ -165,8 +165,8 @@ testTcpConnect = 'let
toSend = "12345"
forkComp (serverThread portVar toSend)
forkComp (clientThread portVar resultVar)
void (forkComp (serverThread portVar toSend))
void (forkComp (clientThread portVar resultVar))
received = take resultVar

View File

@ -39,8 +39,8 @@ spawn k = let
out1 = TVar.newIO None
out2 = TVar.newIO None
counter = atomically '(TVar.new 0)
forkComp '(Right (body k out1 counter))
forkComp '(Right (body k out2 counter))
void (forkComp '(Right (body k out1 counter)))
void (forkComp '(Right (body k out2 counter)))
p = atomically 'let
r1 = TVar.read out1
r2 = TVar.swap out2 None

View File

@ -60,8 +60,8 @@ spawn k = let
out1 = TVar.newIO None
out2 = TVar.newIO None
counter = atomically '(TVar.new 0)
forkComp '(Right (body k out1 counter))
forkComp '(Right (body k out2 counter))
void (forkComp '(Right (body k out1 counter)))
void (forkComp '(Right (body k out2 counter)))
p = atomically 'let
r1 = TVar.read out1
r2 = TVar.swap out2 None

View File

@ -38,7 +38,7 @@ testBasicMultiThreadMVar : '{io2.IO} [Result]
testBasicMultiThreadMVar = 'let
test = 'let
mv = !newEmpty
.builtin.io2.IO.forkComp (thread1 10 mv)
void (forkComp (thread1 10 mv))
next = take mv
expectU "other thread should have incremented" 11 next
@ -79,8 +79,8 @@ testTwoThreads = 'let
send = !MVar.newEmpty
recv = !MVar.newEmpty
.builtin.io2.IO.forkComp (sendingThread 6 send)
.builtin.io2.IO.forkComp (receivingThread send recv)
void (forkComp (sendingThread 6 send))
void (forkComp (receivingThread send recv))
recvd = take recv

View File

@ -45,7 +45,7 @@ testBasicMultiThreadMVar : '{io2.IO} [Result]
testBasicMultiThreadMVar = 'let
test = 'let
mv = !newEmpty
.builtin.io2.IO.forkComp (thread1 10 mv)
void (forkComp (thread1 10 mv))
next = take mv
expectU "other thread should have incremented" 11 next
@ -113,8 +113,8 @@ testTwoThreads = 'let
send = !MVar.newEmpty
recv = !MVar.newEmpty
.builtin.io2.IO.forkComp (sendingThread 6 send)
.builtin.io2.IO.forkComp (receivingThread send recv)
void (forkComp (sendingThread 6 send))
void (forkComp (receivingThread send recv))
recvd = take recv

View File

@ -137,7 +137,7 @@ testConnectSelfSigned _ =
cert = decodeCert (toUtf8 self_signed_cert_pem2)
received = !(testClient (Some cert) "test.unison.cloud" portVar)
kill.impl tid
_ = kill.impl tid
expectU "should have reaped what we've sown" toSend received

View File

@ -154,7 +154,7 @@ testConnectSelfSigned _ =
cert = decodeCert (toUtf8 self_signed_cert_pem2)
received = !(testClient (Some cert) "test.unison.cloud" portVar)
kill.impl tid
_ = kill.impl tid
expectU "should have reaped what we've sown" toSend received

View File

@ -16,10 +16,11 @@ remain in the definition of `baz`.
```unison
foo _ =
id x = x
void x = ()
bar = let
Debug.watch "hello" "hello"
void (Debug.watch "hello" "hello")
result = 5
Debug.watch "goodbye" "goodbye"
void (Debug.watch "goodbye" "goodbye")
result
baz = id bar
baz

View File

@ -12,10 +12,11 @@ remain in the definition of `baz`.
```unison
foo _ =
id x = x
void x = ()
bar = let
Debug.watch "hello" "hello"
void (Debug.watch "hello" "hello")
result = 5
Debug.watch "goodbye" "goodbye"
void (Debug.watch "goodbye" "goodbye")
result
baz = id bar
baz
@ -36,7 +37,7 @@ foo _ =
Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.
11 | > !foo
12 | > !foo
5

View File

@ -9,7 +9,7 @@ Docs can be used as inline code comments.
```unison
foo : Nat -> Nat
foo n =
[: do the thing :]
_ = [: do the thing :]
n + 1
```

View File

@ -5,7 +5,7 @@ Docs can be used as inline code comments.
```unison
foo : Nat -> Nat
foo n =
[: do the thing :]
_ = [: do the thing :]
n + 1
```
@ -26,7 +26,7 @@ foo n =
foo : Nat -> Nat
foo n =
use Nat +
[: do the thing :]
_ = [: do the thing :]
n + 1
```
@ -500,7 +500,7 @@ But note it's not obvious how display should best be handling this. At the mome
foo : Nat -> Nat
foo n =
use Nat +
[: do the thing :]
_ = [: do the thing :]
n + 1 ▶ bar

View File

@ -6,7 +6,7 @@
```unison:hide
printLine : Text ->{IO} ()
printLine msg =
putBytes.impl (stdHandle StdOut) (Text.toUtf8 (msg ++ "\n"))
_ = putBytes.impl (stdHandle StdOut) (Text.toUtf8 (msg ++ "\n"))
()
-- An unannotated main function

View File

@ -2,7 +2,7 @@
```unison
printLine : Text ->{IO} ()
printLine msg =
putBytes.impl (stdHandle StdOut) (Text.toUtf8 (msg ++ "\n"))
_ = putBytes.impl (stdHandle StdOut) (Text.toUtf8 (msg ++ "\n"))
()
-- An unannotated main function

View File

@ -21,7 +21,7 @@ Another example, involving abilities. Here the ability-polymorphic function is i
```unison
f : (forall a g . '{g} a -> '{g} a) -> () -> ()
f id _ =
(id ('1 : '{} Nat), id ('("hi") : '{IO} Text))
_ = (id ('1 : '{} Nat), id ('("hi") : '{IO} Text))
()
```

View File

@ -33,7 +33,7 @@ Another example, involving abilities. Here the ability-polymorphic function is i
```unison
f : (forall a g . '{g} a -> '{g} a) -> () -> ()
f id _ =
(id ('1 : '{} Nat), id ('("hi") : '{IO} Text))
_ = (id ('1 : '{} Nat), id ('("hi") : '{IO} Text))
()
```

View File

@ -38,7 +38,8 @@ testCreateRename _ =
tempDir = newTempDir "fileio"
fooDir = tempDir ++ "/foo"
barDir = tempDir ++ "/bar"
createDirectory.impl fooDir
void x = ()
void (createDirectory.impl fooDir)
check "create a foo directory" (isDirectory fooDir)
check "directory should exist" (fileExists fooDir)
renameDirectory fooDir barDir
@ -47,8 +48,8 @@ testCreateRename _ =
check "bar should now exist" (fileExists barDir)
bazDir = barDir ++ "/baz"
createDirectory.impl bazDir
removeDirectory.impl barDir
void (createDirectory.impl bazDir)
void (removeDirectory.impl barDir)
check "removeDirectory works recursively" (not (isDirectory barDir))
check "removeDirectory works recursively" (not (isDirectory bazDir))

View File

@ -26,7 +26,8 @@ testCreateRename _ =
tempDir = newTempDir "fileio"
fooDir = tempDir ++ "/foo"
barDir = tempDir ++ "/bar"
createDirectory.impl fooDir
void x = ()
void (createDirectory.impl fooDir)
check "create a foo directory" (isDirectory fooDir)
check "directory should exist" (fileExists fooDir)
renameDirectory fooDir barDir
@ -35,8 +36,8 @@ testCreateRename _ =
check "bar should now exist" (fileExists barDir)
bazDir = barDir ++ "/baz"
createDirectory.impl bazDir
removeDirectory.impl barDir
void (createDirectory.impl bazDir)
void (removeDirectory.impl barDir)
check "removeDirectory works recursively" (not (isDirectory barDir))
check "removeDirectory works recursively" (not (isDirectory bazDir))

View File

@ -12,9 +12,7 @@ unique type A = A
threadEyeDeez _ =
t1 = forkComp '()
t2 = forkComp '()
t1 == t2
t1 < t2
()
(t1 == t2, t1 < t2)
```
```ucm

View File

@ -8,9 +8,7 @@ unique type A = A
threadEyeDeez _ =
t1 = forkComp '()
t2 = forkComp '()
t1 == t2
t1 < t2
()
(t1 == t2, t1 < t2)
```
```ucm
@ -22,7 +20,7 @@ threadEyeDeez _ =
⍟ These new definitions are ok to `add`:
unique type A
threadEyeDeez : ∀ _. _ ->{IO} ()
threadEyeDeez : ∀ _. _ ->{IO} (Boolean, Boolean)
```
```ucm
@ -31,11 +29,11 @@ threadEyeDeez _ =
⍟ I've added these definitions:
unique type A
threadEyeDeez : ∀ _. _ ->{IO} ()
threadEyeDeez : ∀ _. _ ->{IO} (Boolean, Boolean)
.> run threadEyeDeez
()
(false, true)
```
```unison