From aafc45eb5eed3839a5210a7d48928d975df6a296 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 11 Apr 2015 20:38:08 +0200 Subject: Handle a configuration file to save the url --- src/View/Ad.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/View') 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) -- cgit v1.2.3