streamly
streamly copied to clipboard
Add chainl1 to the ParserK module
{-# INLINE chainl1 #-}
chainl1 :: ParserK b IO a -> ParserK b IO (a -> a -> a) -> ParserK b IO a
chainl1 p op = p >>= go
where
go l =
step l <|> pure l
step l = do
c <- op
r <- p
go (c l r)