
11 Jan
2012
11 Jan
'12
7:40 p.m.
A new solution that drops two 'runResourceT' calls: telnet :: String -> Int -> IO () telnet host port = runResourceT $ do (releaseSock, hsock) <- with (connectTo host $ PortNumber $ fromIntegral port) hClose liftIO $ mapM_ (\h -> hSetBuffering h LineBuffering) [ stdin, stdout, hsock ] (releaseThread, _) <- with (forkIO $ runResourceT $ sourceHandle stdin $$ sinkHandle hsock) killThread sourceHandle hsock $$ sinkHandle stdout release releaseThread release releaseSock Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/