Add requireA/requireAllA functions

This commit is contained in:
Jasper Van der Jeugt 2011-01-18 23:58:29 +01:00
parent 374a9dde5a
commit 89cd33c723

View file

@ -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