From c8c9fb0eb199a47012d0d5c851835a92ff095b79 Mon Sep 17 00:00:00 2001 From: Szumi Xie Date: Tue, 6 Aug 2024 16:31:31 +0200 Subject: [PATCH] Inline applicative operators --- CHANGELOG.md | 2 ++ Text/Megaparsec/Internal.hs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e93376be..2dfc2e00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ * Implemented correct handling of wide Unicode characters in error messages. To that end, a new module `Text.Megaparsec.Unicode` was introduced. [Issue 370](https://github.com/mrkkrp/megaparsec/issues/370). +* Inlined `Applicative` operators `(<*)` and `(*>)`. [PR + 566](https://github.com/mrkkrp/megaparsec/pull/566). ## Megaparsec 9.6.1 diff --git a/Text/Megaparsec/Internal.hs b/Text/Megaparsec/Internal.hs index 4357250a..26ef6e81 100644 --- a/Text/Megaparsec/Internal.hs +++ b/Text/Megaparsec/Internal.hs @@ -174,7 +174,9 @@ instance (Stream s) => Applicative (ParsecT e s m) where pure = pPure (<*>) = pAp p1 *> p2 = p1 `pBind` const p2 + {-# INLINE (*>) #-} p1 <* p2 = do x1 <- p1; void p2; return x1 + {-# INLINE (<*) #-} pPure :: (Stream s) => a -> ParsecT e s m a pPure x = ParsecT $ \s _ _ eok _ -> eok x s mempty