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:
Matthew Pickering 2014-07-20 23:41:42 +01:00
parent b983adf0d0
commit 8271fb574e

View file

@ -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)))