summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-18 23:58:29 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-18 23:58:29 +0100
commit89cd33c7230bae30de5f74afab7fe50b2a6517db (patch)
treeca9996f3e3ffd413d060ba44021659e1ba665ea1 /src/Hakyll/Core
parent374a9dde5a3907dd22a1723c8916b578c4f7caf3 (diff)
downloadhakyll-89cd33c7230bae30de5f74afab7fe50b2a6517db.tar.gz
Add requireA/requireAllA functions
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r--src/Hakyll/Core/Compiler.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs
index a2853a4..edb3eeb 100644
--- a/src/Hakyll/Core/Compiler.hs
+++ b/src/Hakyll/Core/Compiler.hs
@@ -9,7 +9,9 @@ module Hakyll.Core.Compiler
, getResourceString
, fromDependency
, require
+ , requireA
, requireAll
+ , requireAllA
, cached
, unsafeCompiler
) where
@@ -108,6 +110,14 @@ require identifier f =
y <- getDependency identifier
return $ f x y
+-- | Arrow-based variant of 'require'
+--
+requireA :: (Binary a, Typeable a, Writable a)
+ => Identifier
+ -> Compiler (b, a) c
+ -> Compiler b c
+requireA identifier = (require identifier (,) >>>)
+
-- | Require a number of targets. Using this function ensures automatic handling
-- of dependencies
--
@@ -124,6 +134,14 @@ requireAll pattern f =
items <- mapM (unCompilerM . getDependency) deps
return $ f x items
+-- | Arrow-based variant of 'require'
+--
+requireAllA :: (Binary a, Typeable a, Writable a)
+ => Pattern
+ -> Compiler (b, [a]) c
+ -> Compiler b c
+requireAllA pattern = (requireAll pattern (,) >>>)
+
cached :: (Binary a, Typeable a, Writable a)
=> String
-> Compiler () a