Skip to content

Commit

Permalink
Merge pull request #5802 from haskell/runParsecParser-prime
Browse files Browse the repository at this point in the history
Add runParsecParser', which takes CabalSpecVersion
  • Loading branch information
phadej committed Dec 17, 2018
2 parents f7c2f57 + c2bcfcc commit 1259836
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Cabal/Distribution/Parsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Distribution.Parsec (
Parsec(..),
ParsecParser (..),
runParsecParser,
runParsecParser',
simpleParsec,
lexemeParsec,
eitherParsec,
Expand Down Expand Up @@ -181,7 +182,14 @@ explicitEitherParsec parser

-- | Run 'ParsecParser' with 'cabalSpecLatest'.
runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either Parsec.ParseError a
runParsecParser p n = Parsec.runParser (unPP p cabalSpecLatest <* P.eof) [] n
runParsecParser = runParsecParser' cabalSpecLatest

-- | Like 'runParsecParser' but lets specify 'CabalSpecVersion' used.
--
-- @since 3.0.0.0
--
runParsecParser' :: CabalSpecVersion -> ParsecParser a -> FilePath -> FieldLineStream -> Either Parsec.ParseError a
runParsecParser' v p n = Parsec.runParser (unPP p v <* P.eof) [] n

instance Parsec a => Parsec (Identity a) where
parsec = Identity <$> parsec
Expand Down

0 comments on commit 1259836

Please sign in to comment.