diff options
author | Joris | 2018-06-17 23:24:47 +0200 |
---|---|---|
committer | Joris | 2018-06-18 11:13:55 +0200 |
commit | 0a4d3c8f12dc5797a919a00b6bcaf759947687cc (patch) | |
tree | bcb89781e22c2314bf0c064ebb37cb7f8a362f5c /src/parser/haskell/Model | |
parent | e2a5c7c5c596d057b6fa9c08a8204ce1429cfdc4 (diff) |
Add ouest france parser
Diffstat (limited to 'src/parser/haskell/Model')
-rw-r--r-- | src/parser/haskell/Model/Ad.hs | 22 | ||||
-rw-r--r-- | src/parser/haskell/Model/URL.hs | 7 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/parser/haskell/Model/Ad.hs b/src/parser/haskell/Model/Ad.hs new file mode 100644 index 0000000..06906eb --- /dev/null +++ b/src/parser/haskell/Model/Ad.hs @@ -0,0 +1,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) diff --git a/src/parser/haskell/Model/URL.hs b/src/parser/haskell/Model/URL.hs new file mode 100644 index 0000000..2114113 --- /dev/null +++ b/src/parser/haskell/Model/URL.hs @@ -0,0 +1,7 @@ +module Model.URL + ( URL + ) where + +import Data.Text + +type URL = Text |