This week a medium length tutorial on network programming in Haskell. We
build a concise IRC bot, and toss some custom control structures and a
monad into the mixture. A small taste:
type Net = ReaderT Bot IO
data Bot = Bot { socket :: Handle }
main :: IO ()
main = bracket connect disconnect loop
listen :: Handle -> Net ()
listen h = forever $ do
s <- io (hGetLine h)
io (putStrLn s)
when (ping s) $ pong s
Read the tutorial.
/home ::
/haskell ::
permalink ::
rss