Skip to content

rest primitive String parser #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamesdbrock opened this issue Feb 10, 2021 · 3 comments · Fixed by #140
Closed

rest primitive String parser #110

jamesdbrock opened this issue Feb 10, 2021 · 3 comments · Fixed by #140

Comments

@jamesdbrock
Copy link
Member

I needed this rest parser today so I wrote something like it. It's pretty common and I think we should include it in the primitive parsers for Text.Parsing.Parser.String.

-- | Parse and return the rest of the input. Always succeeds.
rest :: forall m. Monad m => ParserT String m String
rest = do
  ParseState input position _ <- get
  set $ ParseState "" (updatePosString position input) true
  pure input

Except we can't write it for StringLike. Are we sure that the StringLike typeclass is a good idea?

rest :: forall m s. StringLike s => Monad m => ParserT s m s
@jamesdbrock
Copy link
Member Author

Also take n, drop n.

@jamesdbrock
Copy link
Member Author

And takeWhile, dropWhile.

@jamesdbrock
Copy link
Member Author

And regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant