From 36ec2c15b8dece790e4a5e02dc9a4bd1782c7a5f Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 26 Dec 2010 11:57:42 +0100 Subject: Add targetFromString compiler function --- src/Hakyll/Core/Compiler.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') 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 >>=) -- cgit v1.2.3