Verified Commit 3197ed33 authored by Allele Dev's avatar Allele Dev

docs: clarify protections and limitations

parent 992bd890
......@@ -17,6 +17,34 @@ properties at the type level. Currently, the following are tracked:
* socket protocol: tcp, udp
* socket shutdown state: available, can't send, can't receive, etc
This makes it so that many socket programming errors are caught before
the program is ever run. For example:
* sending or receiving from a TCP socket that isn't connected
* can still `sendTo`/`recvFrom` for UDP sockets
* listening on a socket that hasn't been bound
* accepting from a socket that hasn't started listening
* sending from a socket that has had it's send capability `shutdown`
* receiving from a socket that has had it's recv capability `shutdown`
However, the protection isn't perfect. In particular, until linear
types are used, the following is one way to cause errors in lieu
of the type protection:
1. Create a thread taking a socket and modify the socket in the parent view:
``` haskell
sock <- tcp4Socket
bound <- bind serverAddress sock
server <- listen 1 bound
forkIO (doThing server)
close server
doThings :: SSocket f p s sh -> IO ()
doThings server = do
accept server -- this will crash because of the close above
## Examples
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment