Skip to content

Instantly share code, notes, and snippets.

@munro
Created May 28, 2015 17:47
Show Gist options
  • Save munro/66c4d89df61ea5d6bf91 to your computer and use it in GitHub Desktop.
Save munro/66c4d89df61ea5d6bf91 to your computer and use it in GitHub Desktop.
-- |
-- >>> 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