summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2014-10-29 10:47:22 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2014-10-29 10:47:22 +0100
commit76cfb5395896d7f2534863081d62dc016470b6e7 (patch)
tree6873525c1f904091124ca683f5716f55d717b09e
parent3c15d0fd34e6fd8b2a2c2c9185f5554fc266efbc (diff)
downloadhakyll-76cfb5395896d7f2534863081d62dc016470b6e7.tar.gz
Add listFieldWith
-rw-r--r--src/Hakyll/Web/Template/Context.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs
index b5066a6..2da76d4 100644
--- a/src/Hakyll/Web/Template/Context.hs
+++ b/src/Hakyll/Web/Template/Context.hs
@@ -6,6 +6,7 @@ module Hakyll.Web.Template.Context
, field
, constField
, listField
+ , listFieldWith
, functionField
, mapContext
@@ -104,7 +105,13 @@ constField key = field key . const . return
--------------------------------------------------------------------------------
listField :: String -> Context a -> Compiler [Item a] -> Context b
-listField key c xs = field' key $ \_ -> fmap (ListField c) xs
+listField key c xs = listFieldWith key c (const xs)
+
+
+--------------------------------------------------------------------------------
+listFieldWith
+ :: String -> Context a -> (Item b -> Compiler [Item a]) -> Context b
+listFieldWith key c f = field' key $ fmap (ListField c) . f
--------------------------------------------------------------------------------