aboutsummaryrefslogtreecommitdiff
path: root/src/AdListener.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/AdListener.hs')
-rw-r--r--src/AdListener.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/AdListener.hs b/src/AdListener.hs
index d676b61..dbd7a71 100644
--- a/src/AdListener.hs
+++ b/src/AdListener.hs
@@ -11,7 +11,7 @@ import qualified Data.Text.IO as T
import Control.Concurrent (threadDelay)
-import Ad (getResumes, getAds)
+import Ad (fetchResumes, fetchAds)
import Model.Ad
import Model.URL
@@ -27,7 +27,7 @@ import qualified Config as C
listenToNewAds :: Config -> IO ()
listenToNewAds config = do
- eitherResumes <- getResumes (C.url config)
+ eitherResumes <- fetchResumes (C.url config)
case eitherResumes of
Left error ->
listenError config [] error
@@ -37,7 +37,7 @@ listenToNewAds config = do
listenToNewAdsWithViewedURLs :: Config -> [URL] -> IO ()
listenToNewAdsWithViewedURLs config viewedURLs = do
- eitherResumes <- getResumes (C.url config)
+ eitherResumes <- fetchResumes (C.url config)
case eitherResumes of
Left error ->
listenError config viewedURLs error
@@ -48,7 +48,7 @@ listenToNewAdsWithResumes :: Config -> [URL] -> [Resume] -> IO ()
listenToNewAdsWithResumes config viewedURLs resumes =
let (newURLs, newResumes) = getNewResumes viewedURLs resumes
in do
- eitherNewAds <- getAds newResumes
+ eitherNewAds <- fetchAds newResumes
case eitherNewAds of
Left error ->
listenError config viewedURLs error
@@ -68,7 +68,9 @@ newAdsMessage newAds =
T.concat
[ "Got "
, T.pack . show . length $ newAds
- , " new ads."
+ , " new ad"
+ , if length newAds > 1 then "s" else ""
+ , "."
]
line = T.map (\_ -> '-') newAdsMessage
in T.intercalate