summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-26 11:57:42 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-26 11:57:42 +0100
commit36ec2c15b8dece790e4a5e02dc9a4bd1782c7a5f (patch)
tree66ee56a8d34e7b6e67d3dcf61dec99a8b47bfeca /src
parent427a74003804a29e48022a901e42e0f73311058f (diff)
downloadhakyll-36ec2c15b8dece790e4a5e02dc9a4bd1782c7a5f.tar.gz
Add targetFromString compiler function
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Core/Compiler.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs
index 42598f6..70006e9 100644
--- a/src/Hakyll/Core/Compiler.hs
+++ b/src/Hakyll/Core/Compiler.hs
@@ -8,6 +8,7 @@ module Hakyll.Core.Compiler
, runCompiler
, require
, target
+ , targetFromString
) where
import Control.Arrow (second)
@@ -18,6 +19,7 @@ import Data.Set (Set)
import qualified Data.Set as S
import Hakyll.Core.Identifier
+import Hakyll.Core.Target
import Hakyll.Core.Target.Internal
-- | A set of dependencies
@@ -78,3 +80,10 @@ require identifier = do
--
target :: TargetM a a -> Compiler a
target = return
+
+-- | Construct a target from a string, this string being the content of the
+-- resource.
+--
+targetFromString :: (String -> TargetM a a) -- ^ Function to create the target
+ -> Compiler a -- ^ Resulting compiler
+targetFromString = target . (getResourceString >>=)