2024-04-15 02:57:08 +03:00
|
|
|
We had bugs in the calling conventions for both send and terminate which would
|
2023-02-08 00:51:04 +03:00
|
|
|
cause pattern matching on the resulting (Right ()) would cause a runtime error.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2023-02-08 00:36:17 +03:00
|
|
|
use builtin.io2.Tls newClient send handshake terminate
|
|
|
|
|
2023-02-08 00:51:04 +03:00
|
|
|
frank: '{IO} ()
|
2024-04-15 02:57:08 +03:00
|
|
|
frank = do
|
2023-02-27 19:30:44 +03:00
|
|
|
socket = assertRight (clientSocket.impl "example.com" "443")
|
2023-02-08 00:36:17 +03:00
|
|
|
config = ClientConfig.default "example.com" 0xs
|
2023-02-27 19:30:44 +03:00
|
|
|
tls = assertRight (newClient.impl config socket)
|
|
|
|
() = assertRight (handshake.impl tls)
|
|
|
|
() = assertRight (send.impl tls 0xs)
|
|
|
|
() = assertRight (terminate.impl tls)
|
2023-02-08 00:36:17 +03:00
|
|
|
()
|
2023-02-27 19:30:44 +03:00
|
|
|
|
|
|
|
assertRight : Either a b -> b
|
|
|
|
assertRight = cases
|
|
|
|
Right x -> x
|
|
|
|
Left _ -> bug "expected a right but got a left"
|
2023-02-08 00:36:17 +03:00
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-02-08 00:36:17 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2023-02-08 00:36:17 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
2023-02-27 19:30:44 +03:00
|
|
|
assertRight : Either a b -> b
|
|
|
|
frank : '{IO} ()
|
2023-02-08 00:36:17 +03:00
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2023-02-08 00:36:17 +03:00
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
2023-02-27 19:30:44 +03:00
|
|
|
assertRight : Either a b -> b
|
|
|
|
frank : '{IO} ()
|
2023-02-08 00:36:17 +03:00
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> run frank
|
2023-02-08 00:36:17 +03:00
|
|
|
|
2023-02-08 00:51:04 +03:00
|
|
|
()
|
2023-02-08 00:36:17 +03:00
|
|
|
|
|
|
|
```
|