diff options
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) |