-
-
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
ApplicativeError: catchNonFatal, catchNonFatalEval and fromTry are not covered by laws #1908
Comments
Unfortunately that's the not the case for most of type classes when it comes to implemented methods. Some of them are covered by tests for the type classes themselves, some are not covered at all. @non recently added a bunch of such tests to laws and name them with a "Ref" suffix. Maybe we should make it a convention. |
+1 to make it a convention: if there is a default implementation that may be slow, we should add a law that every implementation matches that but may have better ways to implement. |
Maybe we can use something like I mentioned here. In essence create a wrapper for every type class which uses the implementations of the fundamental operations of that type class of the data type it wraps. We can than compare the actual implementation (eg This way the consistency laws wouldn't need to reimplement the default implementation. |
@peterneyens yeah, we dropped the ball on that one. I like that approach. It seems possible to generate check methods using macro so that all future methods with default implementation can be automatically tested. It maybe even possible to generate the wrappers, but that seems trickier. |
There are currently no laws in
ApplicativeErrorLaws
that cover:catchNonFatal
catchNonFatalEval
fromTry
When I check the associated laws for a type-class, I expect to get full code coverage given good enough
Arbitrary
values.The text was updated successfully, but these errors were encountered: