blob: 7bc66fcbde0c79ce3bb176709e7763a58799ba79 (
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
( getResumes
, getAds
) 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
getResumes :: URL -> IO (Either Text [Resume])
getResumes url = fmap parseResumes <$> getPage url
getAds :: [Resume] -> IO (Either Text [Ad])
getAds resumes = do
xs <- sequence $ map getAd resumes
return $ sequence xs
getAd :: Resume -> IO (Either Text Ad)
getAd resume = do
page <- getPage (url resume)
fmap (\page -> Ad { resume = resume, detail = parseDetail page}) <$> getPage (url resume)
|