From 89cd33c7230bae30de5f74afab7fe50b2a6517db Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 18 Jan 2011 23:58:29 +0100 Subject: Add requireA/requireAllA functions --- src/Hakyll/Core/Compiler.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Hakyll') 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 -- cgit v1.2.3