download 0.2 → 0.3
raw patch · 3 files changed
+45/−17 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Network.Download: parseFeed :: String -> IO (Either String Feed)
- Network.Download: parseTags :: String -> IO (Either String [Tag])
- Network.Download: parseXML :: String -> IO (Either String [Content])
+ Network.Download: openAsFeed :: String -> IO (Either String Feed)
+ Network.Download: openAsTags :: String -> IO (Either String [Tag])
+ Network.Download: openAsXML :: String -> IO (Either String [Content])
Files
- Network/Download.hsc +9/−9
- cbits/file.c +1/−0
- download.cabal +35/−8
Network/Download.hsc view
@@ -30,9 +30,9 @@ , openURIString -- * Parsers for common formats- , parseTags- , parseXML- , parseFeed+ , openAsTags+ , openAsXML+ , openAsFeed ) where @@ -105,20 +105,20 @@ -- | Download the content as for "openURI", but return it as a list of -- parsed tags using the tagsoup html parser. ---parseTags:: String -> IO (Either String [TagSoup.Tag])-parseTags s = (fmap TagSoup.parseTags) `fmap` openURIString s+openAsTags:: String -> IO (Either String [TagSoup.Tag])+openAsTags s = (fmap TagSoup.parseTags) `fmap` openURIString s -- | Download the content as for "openURI", but return it as parsed XML, -- using the xml-light parser. ---parseXML:: String -> IO (Either String [XML.Content])-parseXML s = (fmap XML.parseXML) `fmap` openURIString s+openAsXML:: String -> IO (Either String [XML.Content])+openAsXML s = (fmap XML.parseXML) `fmap` openURIString s -- | Download the content as for "openURI", but return it as parsed RSS -- or Atom content, using the feed library parser. ---parseFeed :: String -> IO (Either String Feed.Feed)-parseFeed s = do+openAsFeed :: String -> IO (Either String Feed.Feed)+openAsFeed s = do e <- openURIString s return $ case e of Left err -> Left err -- gluing Either -> Maybe
cbits/file.c view
@@ -33,6 +33,7 @@ #include <sys/param.h> #include <sys/stat.h>+#include <unistd.h> #include <dirent.h> #include <stdio.h>
download.cabal view
@@ -1,13 +1,40 @@ name: download-version: 0.2+version: 0.3 homepage: http://code.haskell.org/~dons/code/download synopsis: High-level file download based on URLs description: High-level file download based on URLs- .- Download web content as strict bytestring, strings,- HTML tags, XML, RSS or Atom feeds or JSON, via HTTP,- FTP or file protocols, using a URL interface.- . + .+ Download web content as strict bytestring, strings, HTML tags, XML, RSS+ or Atom feeds or JSON, via HTTP, FTP or file protocols, using a URL+ interface.+ .+ Importing the library:+ . + > import Network.Download+ .+ Loading a webpage as a "ByteString":+ .+ > doc <- openURI "http://haskell.org"+ .+ Loading from a file:+ .+ > doc <- openURI "file:///tmp/A.hs"+ .+ Loading a HTML page as a list of tags:+ .+ > tags <- openAsTags "http://haskell.org"+ .+ Loading a HTML page as XML:+ .+ > tags <- openAsXML "http://haskell.org"+ .+ Loading an RSS or Atom feed:+ .+ > feed <- openAsFeed "http://haskell.org"+ .+ These data types can the be processed further with the XML, Feed and+ TagSoup libraries.+ . category: Network license: BSD3 license-file: LICENSE@@ -68,8 +95,8 @@ cbits/hs_download_utils.c include-dirs: cbits- includes: common.h- download.h+ includes: download.h+ common.h ftperr.h httperr.h hs_download_utils.h