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.
This commit is contained in:
John MacFarlane
2021-03-20 15:58:32 -07:00
parent 4d041953f5
commit ce418667ae
5 changed files with 9 additions and 9 deletions
+2 -1
View File
@@ -686,7 +686,8 @@ yamlToMeta (Mapping _ _ m) =
either (fail . show) return $ runEverything (yamlMap pMetaString m)
where
pMetaString = pure . MetaString <$> P.manyChar P.anyChar
runEverything p = runPure (P.readWithM p def "")
runEverything p =
runPure (P.readWithM p (def :: P.ParserState) "")
>>= fmap (Meta . flip P.runF def)
yamlToMeta _ = return mempty
+2 -5
View File
@@ -112,7 +112,6 @@ module Text.Pandoc.Parsing ( take1WhileP,
citeKey,
Parser,
ParserT,
F,
Future(..),
runF,
askF,
@@ -229,8 +228,6 @@ type ParserT = ParsecT
newtype Future s a = Future { runDelayed :: Reader s a }
deriving (Monad, Applicative, Functor)
type F = Future ParserState
runF :: Future s a -> s -> a
runF = runReader . runDelayed
@@ -1169,7 +1166,7 @@ data ParserState = ParserState
stateInNote :: Bool, -- ^ True if parsing note contents
stateNoteNumber :: Int, -- ^ Last note number for citations
stateMeta :: Meta, -- ^ Document metadata
stateMeta' :: F Meta, -- ^ Document metadata
stateMeta' :: Future ParserState Meta, -- ^ Document metadata
stateCitations :: M.Map Text Text, -- ^ RST-style citations
stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
stateIdentifiers :: Set.Set Text, -- ^ Header identifiers used
@@ -1348,7 +1345,7 @@ data QuoteContext
type NoteTable = [(Text, Text)]
type NoteTable' = M.Map Text (SourcePos, F Blocks)
type NoteTable' = M.Map Text (SourcePos, Future ParserState Blocks)
-- used in markdown reader
newtype Key = Key Text deriving (Show, Read, Eq, Ord)
+2
View File
@@ -52,6 +52,8 @@ import Text.Pandoc.Readers.Metadata (yamlBsToMeta, yamlBsToRefs)
type MarkdownParser m = ParserT Text ParserState m
type F = Future ParserState
-- | Read markdown from an input string and return a Pandoc document.
readMarkdown :: PandocMonad m
=> ReaderOptions -- ^ Reader options
+1 -1
View File
@@ -36,7 +36,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Error (PandocError (PandocParsecError))
import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (F)
import Text.Pandoc.Parsing
import Text.Pandoc.Shared (crFilter, trimr, tshow)
-- | Read Muse from an input string and return a Pandoc document.
+2 -2
View File
@@ -106,8 +106,8 @@ module Text.Pandoc.Readers.Org.Parsing
import Data.Text (Text)
import Text.Pandoc.Readers.Org.ParserState
import Text.Pandoc.Parsing hiding (F, anyLine, blanklines, newline,
parseFromString)
import Text.Pandoc.Parsing hiding (anyLine, blanklines, newline,
parseFromString)
import qualified Text.Pandoc.Parsing as P
import Control.Monad (guard)