-
-
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 some helper methods to MonadError #562
Conversation
You should make me write unit tests and ScalaDocs for these before you merge. I wanted to open a PR before I forgot about this though.
Also I should override some of these with optimized versions in some of the instances. |
Awesome possum |
Current coverage is
|
I started to add some laws, but I went down a rabbit hole upon realizing that Scalacheck doesn't provide generators for partial functions. |
You can always create a Arbitrary(arbitrary[A => Option[B]].map { f =>
new PartialFunction[A, B] {
def isDefinedAt(a: A): Boolean = f(a).isDefined
def apply(a: A): B = f(a).get
}) |
@non right. There's even a |
These probably don't have the best names. I'm open to naming suggestions.
I added some I'm going to add some optimized overrides, and then this PR will be ready for review (but feel free to comment now). |
As I was documenting some of the |
That sounds good to me. I say go for it! We have time to change it if it doesn't end up being good in practice. |
Many of these "laws" are basically tests for default implementations. I'm not sure whether or not they should exist in their current form. This is something that has been talked about in the past, but I don't think we really reached a verdict on how to go about this.
Okay I pushed some more changes. Many of these "laws" are basically tests for default implementations. I'm not sure whether or not they should exist in their current form. This is something that has been talked about in the past, but I don't think we really reached a verdict on how to go about this. I figured it probably doesn't hurt much to add them for now, and we can always rip them out later. |
That didn't make it very clear, but I think this is ready to review, and I don't have any pending changes. |
Woaaa awesome 👍 from me |
I 100% support laws for testing default implementations (I think they are great examples of coherence that a user can expect), so +1 from me. |
Looks like there is a Scaladoc error here, but if that is cleaned up 👍 from me. |
Build is green again. I'm going to go ahead and merge. |
Add some helper methods to MonadError
You should make me write unit tests and ScalaDocs for these before you
merge. I wanted to open a PR before I forgot about this though.