diff options
author | Joris Guyonvarch | 2015-04-11 14:06:14 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-04-11 14:06:14 +0200 |
commit | 9f389a05cc883213327b8d17db6d23c3ff8fb4e1 (patch) | |
tree | 36185d54d0695be0c812e7917ac5e919a3e8d045 /src/Model | |
parent | 2f90280ae5059833b5e533e823b1c01338990cb1 (diff) |
Set up a listener that diff new ads and show only the new ones
Diffstat (limited to 'src/Model')
-rw-r--r-- | src/Model/Resume.hs | 17 | ||||
-rw-r--r-- | src/Model/URL.hs | 5 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/Model/Resume.hs b/src/Model/Resume.hs index 1b73baf..f4e9cd5 100644 --- a/src/Model/Resume.hs +++ b/src/Model/Resume.hs @@ -1,9 +1,24 @@ module Model.Resume ( Resume(..) + , getNewResumes + , getURLs ) where +import Data.List ((\\)) + +import Model.URL + data Resume = Resume { name :: String , price :: Maybe String - , url :: String + , url :: URL } deriving (Eq, Read, Show) + +getNewResumes :: [URL] -> [Resume] -> ([URL], [Resume]) +getNewResumes viewdURLs resumes = + let newURLs = (getURLs resumes) \\ viewdURLs + newResumes = filter (\resume -> elem (url resume) newURLs) resumes + in (viewdURLs ++ newURLs, newResumes) + +getURLs :: [Resume] -> [URL] +getURLs = map url diff --git a/src/Model/URL.hs b/src/Model/URL.hs new file mode 100644 index 0000000..91cf22a --- /dev/null +++ b/src/Model/URL.hs @@ -0,0 +1,5 @@ +module Model.URL + ( URL + ) where + +type URL = String |