diff options
author | Joris Guyonvarch | 2015-04-11 14:06:14 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-04-11 14:06:14 +0200 |
commit | 9f389a05cc883213327b8d17db6d23c3ff8fb4e1 (patch) | |
tree | 36185d54d0695be0c812e7917ac5e919a3e8d045 /src/Ad.hs | |
parent | 2f90280ae5059833b5e533e823b1c01338990cb1 (diff) |
Set up a listener that diff new ads and show only the new ones
Diffstat (limited to 'src/Ad.hs')
-rw-r--r-- | src/Ad.hs | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1,19 +1,22 @@ module Ad ( getAds + , getResumes ) where -import Text.HTML.TagSoup (parseTags) - import Page (getPage) import Model.Ad import Model.Resume import Model.Detail +import Model.URL import Parser.Resume import Parser.Detail -getAds :: String -> IO (Either String [Ad]) +getResumes :: URL -> IO (Either String [Resume]) +getResumes url = fmap parseResumes <$> getPage url + +getAds :: URL -> IO (Either String [Ad]) getAds url = do eitherPage <- getPage url case eitherPage of @@ -30,4 +33,4 @@ getAdsFromPage page = do getAd :: Resume -> IO (Either String Ad) getAd resume = do page <- getPage (url resume) - fmap (\page -> Ad { resume = resume, detail = parseDetail (parseTags page)}) <$> getPage (url resume) + fmap (\page -> Ad { resume = resume, detail = parseDetail page}) <$> getPage (url resume) |