Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- talk :: MVar State -> String -> Handle -> IO ()
- talk mvar address h = do
- line <- hGetLine h
- state <- takeMVar mvar
- putStrLn line
- let result = parseLine state address line
- let newState = fst result
- let answer = snd result
- putMVar mvar newState
- case answer of
- Just value -> hPutStrLn h value
- Nothing -> return ()
- talk mvar address h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement