diff options
author | Joris | 2016-07-14 11:57:12 +0000 |
---|---|---|
committer | Joris | 2016-07-14 12:00:05 +0000 |
commit | 69e69017b75d1cdaa1fd2aef2818de5111b29735 (patch) | |
tree | 99dba8f67dc1c55b2cc22f33f81c59c7355b337b /src/Fetch.hs | |
parent | 04f9a66c66ca137d9fee6ccca228c41fec960fe0 (diff) |
Update code and fix parsers
Diffstat (limited to 'src/Fetch.hs')
-rw-r--r-- | src/Fetch.hs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Fetch.hs b/src/Fetch.hs index a4e8c94..c80a980 100644 --- a/src/Fetch.hs +++ b/src/Fetch.hs @@ -4,20 +4,19 @@ module Fetch ) where import Data.Text (Text) -import qualified Data.Text as T -import Page (getPage) +import Page -import Model.Ad -import Model.Resume -import Model.Detail -import Model.URL +import Model.Ad (Ad(Ad)) +import Model.Resume (Resume) +import qualified Model.Resume as Resume +import Model.URL (URL) -import Parser.Resume -import Parser.Detail +import qualified Parser.Resume as Resume +import qualified Parser.Detail as Detail fetchResumes :: URL -> IO (Either Text [Resume]) -fetchResumes url = fmap parseResumes <$> getPage url +fetchResumes url = fmap Resume.parse <$> Page.get url fetchAds :: [Resume] -> IO (Either Text [Ad]) fetchAds resumes = do @@ -25,6 +24,4 @@ fetchAds resumes = do return $ sequence xs fetchAd :: Resume -> IO (Either Text Ad) -fetchAd resume = do - page <- getPage (url resume) - fmap (\page -> Ad { resume = resume, detail = parseDetail page}) <$> getPage (url resume) +fetchAd resume = fmap (\ad -> Ad resume (Detail.parse ad)) <$> Page.get (Resume.url resume) |