main :: IO ()
main = do
    chan <- newTChanIO
    a1 <- async $ wfind "http://local.lasvegassun.com" 2 [SearchPattern "<h1" False] chan
    a2 <- async $ loop chan
    _ <- waitBoth a1 a2
    return ()
  where
    loop chan = do
        mtext <- atomically $ readTChan chan
        case mtext of
            Nothing -> return ()
            Just txt -> do
                print txt
                loop chan
main :: IO ()
main = do
    chan <- newTChanIO
    a1 <- async $ wfind "http://local.lasvegassun.com" 2 [SearchPattern "<h1" False] chan
    a2 <- async $ loop chan
    _ <- waitBoth a1 a2
    return ()
  where
    loop chan = do
        mtext <- atomically $ readTChan chan
        case mtext of
            Nothing -> return ()
            Just txt -> do
                print txt
                loop chan
main = do
    chan <- newTChanIO
    a1 <- async $ wfind "http://local.lasvegassun.com" 2 [SearchPattern "<h1" False] chan
    a2 <- async $ loop chan
    _ <- waitBoth a1 a2
    return ()
  where
    loop chan = do
        mtext <- atomically $ readTChan chan
        case mtext of
            Nothing -> return ()
            Just txt -> do
                print txt
                loop chan