on master help sign in
Add targetFromString compiler function
commit36ec2c15b8dece790e4a5e02dc9a4bd1782c7a5f authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 26 Dec 2010, 11:57 (16 years ago) parent427a740
1 file changed+9
src/Hakyll/Core/Compiler.hs+9
src/Hakyll/Core/Compiler.hs+9
@@ -8,6 +8,7 @@ module Hakyll.Core.Compiler
88 , runCompiler
99 , require
1010 , target
11+ , targetFromString
1112 ) where
1213
1314import Control.Arrow (second)
@@ -18,6 +19,7 @@ import Data.Set (Set)
1819import qualified Data.Set as S
1920
2021import Hakyll.Core.Identifier
22+import Hakyll.Core.Target
2123import Hakyll.Core.Target.Internal
2224
2325-- | A set of dependencies
@@ -78,3 +80,10 @@ require identifier = do
7880--
7981target :: TargetM a a -> Compiler a
8082target = return
83+
84+-- | Construct a target from a string, this string being the content of the
85+-- resource.
86+--
87+targetFromString :: (String -> TargetM a a) -- ^ Function to create the target
88+ -> Compiler a -- ^ Resulting compiler
89+targetFromString = target . (getResourceString >>=)