Created
May 28, 2015 17:47
-
-
Save munro/66c4d89df61ea5d6bf91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | | |
-- >>> runNetworkOverTCP testNetwork | |
-- "hello" | |
-- >>> runNetworkOverHTTP testNetwork | |
-- "hello" | |
-- >>> runNetworkInMemory testNetwork | |
-- "hello" | |
testNetwork = do | |
userA <- createConnection | |
userB <- createConnection | |
msgVar <- newEmptyMVar | |
forkIO $ do | |
msg <- waitMessage userA | |
forkIO $ do | |
sendMessage userB userA "hello" | |
msg <- takeMVar msgVar | |
return msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment