complete patterns in patternMatchTls

This commit is contained in:
Travis Staton 2023-02-27 11:30:44 -05:00
parent 1739cafc83
commit 281e8f1ddf
No known key found for this signature in database
GPG Key ID: 431DD911A00DAE49
2 changed files with 24 additions and 12 deletions

View File

@ -13,13 +13,18 @@ use builtin.io2.Tls newClient send handshake terminate
frank: '{IO} ()
frank = do
(Right socket) = clientSocket.impl "example.com" "443"
socket = assertRight (clientSocket.impl "example.com" "443")
config = ClientConfig.default "example.com" 0xs
(Right tls) = newClient.impl config socket
(Right ()) = handshake.impl tls
(Right ()) = send.impl tls 0xs
(Right ()) = terminate.impl tls
tls = assertRight (newClient.impl config socket)
() = assertRight (handshake.impl tls)
() = assertRight (send.impl tls 0xs)
() = assertRight (terminate.impl tls)
()
assertRight : Either a b -> b
assertRight = cases
Right x -> x
Left _ -> bug "expected a right but got a left"
```

View File

@ -8,13 +8,18 @@ use builtin.io2.Tls newClient send handshake terminate
frank: '{IO} ()
frank = do
(Right socket) = clientSocket.impl "example.com" "443"
socket = assertRight (clientSocket.impl "example.com" "443")
config = ClientConfig.default "example.com" 0xs
(Right tls) = newClient.impl config socket
(Right ()) = handshake.impl tls
(Right ()) = send.impl tls 0xs
(Right ()) = terminate.impl tls
tls = assertRight (newClient.impl config socket)
() = assertRight (handshake.impl tls)
() = assertRight (send.impl tls 0xs)
() = assertRight (terminate.impl tls)
()
assertRight : Either a b -> b
assertRight = cases
Right x -> x
Left _ -> bug "expected a right but got a left"
```
```ucm
@ -25,7 +30,8 @@ frank = do
⍟ These new definitions are ok to `add`:
frank : '{IO} ()
assertRight : Either a b -> b
frank : '{IO} ()
```
```ucm
@ -33,7 +39,8 @@ frank = do
⍟ I've added these definitions:
frank : '{IO} ()
assertRight : Either a b -> b
frank : '{IO} ()
.> run frank