Skip to content

Lazy error messages #129

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 5 commits into from
Jan 7, 2022
Merged

Conversation

fsoikin
Copy link
Contributor

@fsoikin fsoikin commented Jan 6, 2022

Description of the change

fixes #128

  • Added a new operator <~?>, which is like <?>, but takes a deferred message - i.e. Unit -> String.
  • This is handy when the error message is expensive-ish to construct.
  • Made use of this in oneOf, noneOf, oneOfCodePoints, and noneOfCodePoints.
  • In all other usages of <?> the error message is either a string literal or a very mall expression, like show c (where c :: Char), which means that in all those cases constructing a closure for deferred message would be more expensive. So I left all those usages alone.

Checklist:

  • Added the change to the changelog's "Unreleased" section with a link to this PR and your username
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation in the README and/or documentation directory
  • Added a test for the contribution (if applicable)

@jamesdbrock jamesdbrock merged commit 271e42c into purescript-contrib:main Jan 7, 2022
@fsoikin fsoikin deleted the lazy-errors branch January 7, 2022 17:28
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.

lazy errors
2 participants