Skip to content

Avoid Discard constraints #47

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

Merged
merged 1 commit into from
Feb 15, 2017
Merged

Avoid Discard constraints #47

merged 1 commit into from
Feb 15, 2017

Conversation

mlang
Copy link
Contributor

@mlang mlang commented Feb 15, 2017

No description provided.


-- | Provide a default result in the case where a parser fails without consuming input.
option :: forall m s a. Monad m => a -> ParserT s m a -> ParserT s m a
option a p = p <|> pure a

-- | Optionally parse something, failing quietly.
optional :: forall m s a. Monad m => ParserT s m a -> ParserT s m Unit
optional p = (do p
pure unit) <|> pure unit
optional p = (void p) <|> pure unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Redundant parens here.

@paf31
Copy link
Contributor

paf31 commented Feb 15, 2017

Great, thanks!

@paf31 paf31 merged commit ecf36ef into purescript-contrib:master Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants