Added generalize function which can be used to lift specialised parsers.
Monad m => Parsec s st a -> Parsec T s st m a
This commit is contained in:
parent
b983adf0d0
commit
8271fb574e
1 changed files with 4 additions and 0 deletions
|
@ -109,6 +109,7 @@ module Text.Pandoc.Parsing ( anyLine,
|
|||
askF,
|
||||
asksF,
|
||||
token,
|
||||
generalize,
|
||||
-- * Re-exports from Text.Pandoc.Parsec
|
||||
Stream,
|
||||
runParser,
|
||||
|
@ -1264,3 +1265,6 @@ addWarning mbpos msg =
|
|||
updateState $ \st -> st{
|
||||
stateWarnings = (msg ++ maybe "" (\pos -> " " ++ show pos) mbpos) :
|
||||
stateWarnings st }
|
||||
|
||||
generalize :: (Monad m) => Parser s st a -> ParserT s st m a
|
||||
generalize m = mkPT (\ s -> (return $ (return . runIdentity) <$> runIdentity (runParsecT m s)))
|
||||
|
|
Loading…
Reference in a new issue