Skip to content
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

Add BindReturn to Property CE #364

Merged
merged 3 commits into from
Nov 26, 2021
Merged

Conversation

TysonMN
Copy link
Member

@TysonMN TysonMN commented Sep 21, 2021

This PR is makes progress on issue #332. This PR should be merged before PR #336 (which is still only a draft). After this PR is merged, I will force push an update to the branch in that PR that includes a rebase on top of the branch in this PR.

The main point of this PR is to add BindReturn to the Property computational expression. As the corresponding RFC says

  • BindReturn - adds support and/or efficiency for let! ... return

That is preciously what we need to avoid testing non-shrunken inputs during rechecking.

One "controversial" thing this PR does is remove the Return(bool) method from the Property CE. I removed it because having both this method and BindReturn were giving me compiler errors. Removing Return(bool) was the only solution that I found. Maybe there is another one we could use instead. However, Return(bool) is not necessary. It is syntactic sugar that allows the user to omit putting

|> Property.failOnFalse

after their CE instance. Therefore, I think it is reasonable to remove this.

@TysonMN

This comment has been minimized.

@ghost

This comment has been minimized.

@TysonMN

This comment has been minimized.

@ghost

This comment has been minimized.

@TysonMN

This comment has been minimized.

@TysonMN

This comment has been minimized.

@TysonMN
Copy link
Member Author

TysonMN commented Nov 16, 2021

Separate from this PR, I merged in the code that adds and then uses Property.failOnFalse.

@TysonMN TysonMN force-pushed the add_BindReturn branch 5 times, most recently from 81a6ac4 to 31eb928 Compare November 20, 2021 18:49
Copy link
Member

@dharmaturtle dharmaturtle left a comment

Choose a reason for hiding this comment

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

Ah, I'm a bit late, but I think failOnFalse should've been named failureWhenFalse for two reasons:

  1. It's called Failure in Hedgehog.
  2. failwith exists. My mind conflates failOnFalse with that, so seeing property { ... } |> Property.failOnFalse |> Property.check is slightly surprising. fail is (mostly) a verb, while failure is (mostly) a noun.

Oh well.

Did you intentionally not use checkBool on your tests?

Otherwise LGTM!

@TysonMN
Copy link
Member Author

TysonMN commented Nov 24, 2021

I agree that failure is better than fail. Is when better than on though? How about Property. FailureOnFalse?

@TysonMN TysonMN force-pushed the add_BindReturn branch 3 times, most recently from ac40743 to ea75302 Compare November 26, 2021 16:22
@TysonMN TysonMN force-pushed the add_BindReturn branch 2 times, most recently from 8459fba to a63f90c Compare November 26, 2021 16:35
@TysonMN TysonMN merged commit ee38123 into hedgehogqa:master Nov 26, 2021
@TysonMN TysonMN deleted the add_BindReturn branch November 26, 2021 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants