Skip to content

Commit

Permalink
Inline applicative operators
Browse files Browse the repository at this point in the history
  • Loading branch information
szumixie committed Aug 6, 2024
1 parent 1160ac8 commit 76dc3aa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Text/Megaparsec/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76dc3aa

Please sign in to comment.