blob: 06906eba2039e759f07c86466bed157bd802cb3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Model.Ad
( Ad(..)
, getNewAds
) where
import Data.List ((\\))
import Data.Text (Text)
import Model.URL (URL)
data Ad = Ad
{ name :: Text
, location :: Text
, price :: Maybe Text
, url :: URL
} deriving (Eq, Read, Show)
getNewAds :: [URL] -> [Ad] -> ([URL], [Ad])
getNewAds viewdURLs ads =
let newURLs = (map url ads) \\ viewdURLs
newAds = filter (\ad -> elem (url ad) newURLs) ads
in (newURLs, newAds)
|