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/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe