summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Compiler.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/Compiler.hs')
-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