aboutsummaryrefslogtreecommitdiff
path: root/src/View
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-04-11 20:38:08 +0200
committerJoris Guyonvarch2015-04-11 20:38:08 +0200
commitaafc45eb5eed3839a5210a7d48928d975df6a296 (patch)
tree8574205bdf967b7338e63bc77c2f1374e0843e67 /src/View
parent4ddd6d1f6df2bab75d42b6d45b816e92e7173529 (diff)
Handle a configuration file to save the url
Diffstat (limited to 'src/View')
-rw-r--r--src/View/Ad.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/View/Ad.hs b/src/View/Ad.hs
index 5e408f3..6f094ee 100644
--- a/src/View/Ad.hs
+++ b/src/View/Ad.hs
@@ -6,6 +6,7 @@ module View.Ad
import Data.List (intersperse)
import Data.Maybe (fromMaybe)
+import Data.Text (Text)
import qualified Data.Text as T
import Model.Ad (Ad(..))
@@ -15,10 +16,10 @@ import qualified Model.Resume as Resume
import Model.Detail (Detail(..))
import qualified Model.Detail as Detail
-renderAds :: [Ad] -> T.Text
+renderAds :: [Ad] -> Text
renderAds = T.intercalate "\n\n" . map renderAd
-renderAd :: Ad -> T.Text
+renderAd :: Ad -> Text
renderAd ad =
T.concat
[ renderResume (Ad.resume ad)
@@ -26,13 +27,13 @@ renderAd ad =
, renderDetail (Ad.detail ad)
]
-renderResume :: Resume -> T.Text
+renderResume :: Resume -> Text
renderResume resume =
let formatPrice price = T.concat [" - ", price]
price = fromMaybe "" . fmap formatPrice . Resume.price $ resume
titleLine = T.concat [Resume.name resume, price]
- in T.intercalate "\n" [titleLine, T.pack . Resume.url $ resume]
+ in T.intercalate "\n" [titleLine, Resume.url resume]
-renderDetail :: Detail -> T.Text
+renderDetail :: Detail -> Text
renderDetail detail =
fromMaybe "−" (Detail.description detail)