summaryrefslogtreecommitdiff
path: root/src/Hakyll/Parsec
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2025-01-14 11:48:09 -0600
committerChris Wells <chris@mathematicaster.org>2025-01-14 11:48:09 -0600
commitdae3dca29075d5de8c4c51b3eab9bf0334866c9a (patch)
treed30e1f3186330ca5750df70aefb5050d0105d18b /src/Hakyll/Parsec
parent1a3ecbb58d85f70be0625777f9deb9a58907d2e2 (diff)
downloadmain-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.tar
main-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.tar.gz
main-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.tar.bz2
main-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.tar.lz
main-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.tar.xz
main-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.tar.zst
main-dae3dca29075d5de8c4c51b3eab9bf0334866c9a.zip
Adding new modules
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 ()