megaparsec 9.8.2 → 9.8.3
raw patch · 3 files changed
+74/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- Text/Megaparsec/Stream.hs +67/−3
- megaparsec.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,11 @@ *Megaparsec follows [SemVer](https://semver.org/).* +## Megaparsec 9.8.3++* Added `INLINE` pragmas to the built-in `Stream` instances for `Text` and+ `ByteString`, restoring the performance they had before 9.3.0. [Issue+ 612](https://github.com/mrkkrp/megaparsec/issues/612).+ ## Megaparsec 9.8.2 * Fixed tab expansion in the rendering of the offending line so that it
Text/Megaparsec/Stream.hs view
@@ -201,6 +201,14 @@ | B.null s = Nothing | otherwise = Just . second ShareInput $ B.splitAt n s takeWhile_ p (ShareInput s) = second ShareInput $ B.span p s+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} instance Stream (ShareInput BL.ByteString) where type Token (ShareInput BL.ByteString) = Word8@@ -216,6 +224,14 @@ | BL.null s = Nothing | otherwise = Just . second ShareInput $ BL.splitAt (fromIntegral n) s takeWhile_ p (ShareInput s) = second ShareInput $ BL.span p s+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} instance Stream (ShareInput T.Text) where type Token (ShareInput T.Text) = Char@@ -231,6 +247,14 @@ | T.null s = Nothing | otherwise = Just . second ShareInput $ T.splitAt n s takeWhile_ p (ShareInput s) = second ShareInput $ T.span p s+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} instance Stream (ShareInput TL.Text) where type Token (ShareInput TL.Text) = Char@@ -246,6 +270,14 @@ | TL.null s = Nothing | otherwise = Just . second ShareInput $ TL.splitAt (fromIntegral n) s takeWhile_ p (ShareInput s) = second ShareInput $ TL.span p s+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} -- | This wrapper selects the no-input-sharing 'Stream' implementation for -- 'T.Text' ('TL.Text') and 'B.ByteString' ('BL.ByteString'). This means@@ -371,6 +403,14 @@ take1_ s = second unShareInput <$> take1_ (ShareInput s) takeN_ n s = second unShareInput <$> takeN_ n (ShareInput s) takeWhile_ p s = second unShareInput $ takeWhile_ p (ShareInput s)+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} instance Stream BL.ByteString where type Token BL.ByteString = Token (ShareInput BL.ByteString)@@ -383,6 +423,14 @@ take1_ s = second unShareInput <$> take1_ (ShareInput s) takeN_ n s = second unShareInput <$> takeN_ n (ShareInput s) takeWhile_ p s = second unShareInput $ takeWhile_ p (ShareInput s)+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} instance Stream T.Text where type Token T.Text = Token (ShareInput T.Text)@@ -395,6 +443,14 @@ take1_ s = second unShareInput <$> take1_ (ShareInput s) takeN_ n s = second unShareInput <$> takeN_ n (ShareInput s) takeWhile_ p s = second unShareInput $ takeWhile_ p (ShareInput s)+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} instance Stream TL.Text where type Token TL.Text = Token (ShareInput TL.Text)@@ -407,6 +463,14 @@ take1_ s = second unShareInput <$> take1_ (ShareInput s) takeN_ n s = second unShareInput <$> takeN_ n (ShareInput s) takeWhile_ p s = second unShareInput $ takeWhile_ p (ShareInput s)+ {-# INLINE tokenToChunk #-}+ {-# INLINE tokensToChunk #-}+ {-# INLINE chunkToTokens #-}+ {-# INLINE chunkLength #-}+ {-# INLINE chunkEmpty #-}+ {-# INLINE take1_ #-}+ {-# INLINE takeN_ #-}+ {-# INLINE takeWhile_ #-} -- | Type class for inputs that can also be used for debugging. --@@ -603,9 +667,9 @@ pstateLinePrefix = if sameLine then -- NOTE We don't use difference lists here because it's- -- desirable for 'PosState' to be an instance of 'Eq' and- -- 'Show'. So we just do appending here. Fortunately several- -- parse errors on the same line should be relatively rare.+ -- desirable for 'PosState' to be an instance of 'Eq' and+ -- 'Show'. So we just do appending here. Fortunately several+ -- parse errors on the same line should be relatively rare. pstateLinePrefix ++ f "" else f "" }
megaparsec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: megaparsec-version: 9.8.2+version: 9.8.3 license: BSD-2-Clause license-file: LICENSE.md maintainer: Mark Karpov <markkarpov92@gmail.com>