@@ -2,7 +2,6 @@
22-- manipulate @Context@s.
33module Text.Hakyll.ContextManipulations
44 ( renderValue
5− , renderMissingValue
65 , changeValue
76 , changeUrl
87 , copyValue
@@ -14,7 +13,7 @@ module Text.Hakyll.ContextManipulations
1413 ) where
1514
1615import Control.Monad (liftM)
17−import Control.Arrow (arr, (>>>))
16+import Control.Arrow (arr)
1817import System.Locale (TimeLocale, defaultTimeLocale)
1918import System.FilePath (takeFileName, addExtension, dropExtension)
2019import Data.Time.Format (parseTime, formatTime)
@@ -33,21 +32,10 @@ renderValue :: String -- ^ Key of which the value should be copied.
3332 -> String -- ^ Key the value should be copied to.
3433 -> (String -> String) -- ^ Function to apply on the value.
3534 -> HakyllAction Context Context
36−renderValue source destination f =
37− arr (Context . M.delete destination . unContext)
38− >>> renderMissingValue source destination f
39−
40−-- | Render a value, but do not overwrite the destination value if it already
41−-- exists.
42−--
43−renderMissingValue :: String -- ^ Source key
44− -> String -- ^ Destination key
45− -> (String -> String) -- ^ Function to apply on the value
46− -> HakyllAction Context Context
47−renderMissingValue source destination f = arr $ \(Context context) -> Context $
35+renderValue source destination f = arr $ \(Context context) -> Context $
4836 case M.lookup source context of
4937 Nothing -> context
50− (Just value) -> M.insertWith (flip const) destination (f value) context
38+ (Just value) -> M.insert destination (f value) context
5139
5240-- | Change a value in a @Context@.
5341--