-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 stackUnsafeMonad to MonadTests #1417
Add stackUnsafeMonad to MonadTests #1417
Conversation
👍 I also deem such a relaxed law helpful. |
👍 |
Just restarted the tests since they'd failed immediately during yesterday's outages. |
Current coverage is 91.70% (diff: 100%)
|
I guess it makes sense for us to measure test coverage of test code (?), but since we're explicitly not using this for law checking in Cats itself, I'm not sure what to do here. |
I think we are fine with the coverage. @non wdyt? |
can we call this law as a parent of the normal monad laws (which include stack safety, I don't want them to get out of sync)? Also, can we exercise them once on a monad that is stack safe? |
@johnynek I was reluctant to use I originally had a shared About exercising them on a stack-safe monad—you mean just to have the code do something when tests run? Sure, I could add that and explain the duplication, but it still seems a little odd. |
Well, it's not that odd to me in that actually exercising this code seems like a good thing to do. Strictly speaking we should test the laws by running them with instances that pass, and verifying they detect when instances fail. In that sense, I think the laws are actually somewhat untested since we are only checking for positives now (not negatives) if I'm not mistaken. |
@johnynek I'm more worried about the person looking at the codebase for the first time, seeing If we want to be principled about exercising the laws (which I agree would be a good thing), I'm not sure that should happen in |
@travisbrown yeah. it should be in |
@johnynek Okay, sounds good. When I get back to a computer I'll use |
Sorry, meant to rename something before pushing. Just a second and I'll amend that last commit… |
a6962f4
to
ff665f4
Compare
👍 |
👍 (but looks like we need to resolve some conflicts) |
ff665f4
to
308cc07
Compare
Couldn't you run the test for a safe monad to test the test?
|
@johnynek Right, that's what I'm doing in |
As discussed on Gitter. The basic idea is to let people easily test all of the laws for their monad instances except
tailRecM
's stack safety, if for whatever reason they're not motivated to make theirtailRecM
stack-safe.It's not very DRY, but I didn't want to introduce a bunch of abstraction into test code, and all the instances would be a lot of noise.