summaryrefslogtreecommitdiff
path: root/src/Hakyll/Parsec
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Parsec')
-rw-r--r--src/Hakyll/Parsec/Parsec.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Hakyll/Parsec/Parsec.hs b/src/Hakyll/Parsec/Parsec.hs
index cac653c..123c5fd 100644
--- a/src/Hakyll/Parsec/Parsec.hs
+++ b/src/Hakyll/Parsec/Parsec.hs
@@ -1,7 +1,8 @@
module Hakyll.Parsec.Parsec
( compileParsec
, compileParsec_
- , evalParsec
+ , parsecCompiler
+ , parsecCompiler_
) where
import Prolog
@@ -18,3 +19,9 @@ compileParsec p u itm@(Item i _) = traverse (liftErr . runParser p u (show i)) i
compileParsec_ :: (MonadError [String] m, Stream s Identity t) => Parsec s () a -> Item s -> m (Item a)
compileParsec_ p = compileParsec p ()
+
+parsecCompiler :: (Stream s Identity t, StringConv LazyByteString s) => Parsec s u a -> u -> Compiler (Item a)
+parsecCompiler p u = getResourceLBS >>= compileParsec p u . fmap toSL
+
+parsecCompiler_ :: (Stream s Identity t, StringConv LazyByteString s) => Parsec s () a -> Compiler (Item a)
+parsecCompiler_ p = parsecCompiler p ()