Skip to content

Commit

Permalink
Expand elem/notElem to allow fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
1Jajen1 committed May 16, 2024
1 parent 58f2adf commit 6d07432
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Text/Megaparsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ oneOf ::
-- | Collection of matching tokens
f (Token s) ->
m (Token s)
oneOf cs = satisfy (`elem` cs)
oneOf cs = satisfy (\x -> elem x cs)
{-# INLINE oneOf #-}

-- | As the dual of 'oneOf', @'noneOf' ts@ succeeds if the current token
Expand All @@ -538,7 +538,7 @@ noneOf ::
-- | Collection of taken we should not match
f (Token s) ->
m (Token s)
noneOf cs = satisfy (`notElem` cs)
noneOf cs = satisfy (\x -> notElem x cs)
{-# INLINE noneOf #-}

-- | @'chunk' chk@ only matches the chunk @chk@.
Expand Down
2 changes: 1 addition & 1 deletion parsers-bench/ParsersBench/CSV/Attoparsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ escapedField =

unescapedField :: Parser ByteString
unescapedField =
A.takeWhile (`notElem` (",\"\n\r" :: String))
A.takeWhile (\x -> notElem x [',', '\"', '\n', '\r'])
{-# INLINE unescapedField #-}
2 changes: 1 addition & 1 deletion parsers-bench/ParsersBench/CSV/Megaparsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ unescapedField :: Parser ByteString
unescapedField =
takeWhileP
(Just "unescaped char")
(`notElem` [44, 34, 10, 13])
(\x -> notElem x [44, 34, 10, 13])
{-# INLINE unescapedField #-}

0 comments on commit 6d07432

Please sign in to comment.