Skip to content

liftMaybe, liftEither, liftExceptT #212

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
Nov 10, 2022
Merged

liftMaybe, liftEither, liftExceptT #212

merged 1 commit into from
Nov 10, 2022

Conversation

jamesdbrock
Copy link
Member

@jamesdbrock jamesdbrock commented Nov 9, 2022

Add “validation” functions.

#196


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 linked an issue Nov 9, 2022 that may be closed by this pull request
@jamesdbrock jamesdbrock marked this pull request as ready for review November 9, 2022 03:45
@jamesdbrock
Copy link
Member Author

Any advice @natefaubion ? Is this a good use of Lazy?

@jamesdbrock jamesdbrock force-pushed the liftmaybe branch 2 times, most recently from 719b6ef to 39e93f4 Compare November 9, 2022 04:25
@natefaubion
Copy link
Contributor

In general, I consider Lazy to be unnecessary unless you need to rely on memoization of work. Since you only want to defer an argument to potentially evaluate once in a conditional branch, I would use Unit -> a rather than Lazy a. Lazy has overhead in comparison to Unit -> a because it needs to allocate both a mutable reference box and a closure for the work.

@jamesdbrock
Copy link
Member Author

I would use Unit -> a rather than Lazy a

Thx I'll do that.

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.

liftMaybe, liftEither, liftExceptT Implement Compactable and Filterable for ParserT?
2 participants