module Example.Example where import Text.HTML.TagSoup import Text.HTML.Download import Control.Monad import Data.List import Data.Char grab :: String -> IO () grab x = openItem x >>= putStr parse :: String -> IO () parse x = openItem x >>= putStr . show2 . parseTags where show2 [] = "[]" show2 xs = "[" ++ concat (intersperseNotBroken "\n," $ map show xs) ++ "\n]" -- the standard intersperse has a strictness bug which sucks! intersperseNotBroken :: a -> [a] -> [a] intersperseNotBroken _ [] = [] intersperseNotBroken sep (x:xs) = x : is xs where is [] = [] is (y:ys) = sep : y : is ys {-
-} haskellHitCount :: IO () haskellHitCount = do tags <- liftM parseTags $ openURL "http://haskell.org/haskellwiki/Haskell" let count = fromFooter $ head $ sections (~== "