summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Hakyll/Core/Compiler.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs
index 8d7b13c..a2853a4 100644
--- a/src/Hakyll/Core/Compiler.hs
+++ b/src/Hakyll/Core/Compiler.hs
@@ -11,6 +11,7 @@ module Hakyll.Core.Compiler
, require
, requireAll
, cached
+ , unsafeCompiler
) where
import Prelude hiding ((.), id)
@@ -142,3 +143,9 @@ cached name (Compiler d j) = Compiler d $ const $ CompilerM $ do
Nothing -> error'
where
error' = error "Hakyll.Core.Compiler.cached: Cache corrupt!"
+
+-- | Create an unsafe compiler from a function in IO
+--
+unsafeCompiler :: (a -> IO b) -- ^ Function to lift
+ -> Compiler a b -- ^ Resulting compiler
+unsafeCompiler f = fromJob $ CompilerM . liftIO . f