git.iko.soy/typeable/pandoc
on master help sign in
Text.Pandoc.Parsing: remove F type synonym.

Muse and Org were defining their own F anyway, with their own state. We therefore move this definition to the Markdown reader.

commitce418667ae8a3e6e5bbf2523eef43edf4f803bcf authorJohn MacFarlane <jgm@berkeley.edu> dateSat 20 Mar 2021, 10:41 (6 years ago) parent4d04195
5 files changed+9−9
src/Text/Pandoc/App/Opt.hs+2−1 src/Text/Pandoc/Parsing.hs+2−5 src/Text/Pandoc/Readers/Markdown.hs+2 src/Text/Pandoc/Readers/Muse.hs+1−1 src/Text/Pandoc/Readers/Org/Parsing.hs+2−2
src/Text/Pandoc/App/Opt.hs+2−1
@@ -686,7 +686,8 @@ yamlToMeta (Mapping _ _ m) =
686686 either (fail . show) return $ runEverything (yamlMap pMetaString m)
687687 where
688688 pMetaString = pure . MetaString <$> P.manyChar P.anyChar
689− runEverything p = runPure (P.readWithM p def "")
689+ runEverything p =
690+ runPure (P.readWithM p (def :: P.ParserState) "")
690691 >>= fmap (Meta . flip P.runF def)
691692yamlToMeta _ = return mempty
692693
src/Text/Pandoc/Parsing.hs+2−5
@@ -112,7 +112,6 @@ module Text.Pandoc.Parsing ( take1WhileP,
112112 citeKey,
113113 Parser,
114114 ParserT,
115− F,
116115 Future(..),
117116 runF,
118117 askF,
@@ -229,8 +228,6 @@ type ParserT = ParsecT
229228newtype Future s a = Future { runDelayed :: Reader s a }
230229 deriving (Monad, Applicative, Functor)
231230
232−type F = Future ParserState
233−
234231runF :: Future s a -> s -> a
235232runF = runReader . runDelayed
236233
@@ -1169,7 +1166,7 @@ data ParserState = ParserState
11691166 stateInNote :: Bool, -- ^ True if parsing note contents
11701167 stateNoteNumber :: Int, -- ^ Last note number for citations
11711168 stateMeta :: Meta, -- ^ Document metadata
1172− stateMeta' :: F Meta, -- ^ Document metadata
1169+ stateMeta' :: Future ParserState Meta, -- ^ Document metadata
11731170 stateCitations :: M.Map Text Text, -- ^ RST-style citations
11741171 stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
11751172 stateIdentifiers :: Set.Set Text, -- ^ Header identifiers used
@@ -1348,7 +1345,7 @@ data QuoteContext
13481345
13491346type NoteTable = [(Text, Text)]
13501347
1351−type NoteTable' = M.Map Text (SourcePos, F Blocks)
1348+type NoteTable' = M.Map Text (SourcePos, Future ParserState Blocks)
13521349-- used in markdown reader
13531350
13541351newtype Key = Key Text deriving (Show, Read, Eq, Ord)
src/Text/Pandoc/Readers/Markdown.hs+2
@@ -52,6 +52,8 @@ import Text.Pandoc.Readers.Metadata (yamlBsToMeta, yamlBsToRefs)
5252
5353type MarkdownParser m = ParserT Text ParserState m
5454
55+type F = Future ParserState
56+
5557-- | Read markdown from an input string and return a Pandoc document.
5658readMarkdown :: PandocMonad m
5759 => ReaderOptions -- ^ Reader options
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -36,7 +36,7 @@ import Text.Pandoc.Definition
3636import Text.Pandoc.Error (PandocError (PandocParsecError))
3737import Text.Pandoc.Logging
3838import Text.Pandoc.Options
39−import Text.Pandoc.Parsing hiding (F)
39+import Text.Pandoc.Parsing
4040import Text.Pandoc.Shared (crFilter, trimr, tshow)
4141
4242-- | Read Muse from an input string and return a Pandoc document.
src/Text/Pandoc/Readers/Org/Parsing.hs+2−2
@@ -106,8 +106,8 @@ module Text.Pandoc.Readers.Org.Parsing
106106import Data.Text (Text)
107107import Text.Pandoc.Readers.Org.ParserState
108108
109−import Text.Pandoc.Parsing hiding (F, anyLine, blanklines, newline,
110− parseFromString)
109+import Text.Pandoc.Parsing hiding (anyLine, blanklines, newline,
110+ parseFromString)
111111import qualified Text.Pandoc.Parsing as P
112112
113113import Control.Monad (guard)