git.iko.soy/typeable/attoparsec
on master help sign in
Slightly speed up skipWhile
commit977910186ca5bc877ff88b82d5b8b62ae783852c authorBryan O'Sullivan <bos@serpentine.com> dateSat 12 Feb 2011, 11:37 (16 years ago) parentd717b84
1 file changed+5−5
Data/Attoparsec/Internal.hs+5−5
Data/Attoparsec/Internal.hs+5−5
@@ -365,11 +365,11 @@ skipWhile :: (Word8 -> Bool) -> Parser ()
365365skipWhile p = go
366366 where
367367 go = do
368− input <- wantInput
369− when input $ do
370− t <- B8.dropWhile p <$> get
371− put t
372− when (B.null t) go
368+ t <- B8.dropWhile p <$> get
369+ put t
370+ when (B.null t) $ do
371+ input <- wantInput
372+ when input go
373373{-# INLINE skipWhile #-}
374374
375375-- | Consume input as long as the predicate returns 'False'