From dae3dca29075d5de8c4c51b3eab9bf0334866c9a Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 14 Jan 2025 11:48:09 -0600 Subject: Adding new modules --- src/Hakyll/Parsec/Parsec.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Hakyll/Parsec') 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 () -- cgit v1.2.3