blob: 4be47f4a557d449d3c56cb24dc3f363c1624f660 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module Ad
( fetchResumes
, fetchAds
) where
import Data.Text (Text)
import qualified Data.Text as T
import Page (getPage)
import Model.Ad
import Model.Resume
import Model.Detail
import Model.URL
import Parser.Resume
import Parser.Detail
fetchResumes :: URL -> IO (Either Text [Resume])
fetchResumes url = fmap parseResumes <$> getPage url
fetchAds :: [Resume] -> IO (Either Text [Ad])
fetchAds resumes = do
xs <- sequence $ map fetchAd resumes
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)
|