-
-
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
admit weaker typeclass instances for OptionT when the wrapped Functor… #569
Conversation
Current coverage is
|
Lets try to add a law here that tests consistency between |
I think there is the law here. https://github.com/non/cats/blob/f69b3e19778/laws/src/main/scala/cats/laws/FlatMapLaws.scala#L18-L19 |
Ah, I see. In order to get the tests to fail on this change we'd have to create a situation where |
|
Thanks @xuwei-k. |
yes, thanks @xuwei-k ! |
…cative instance for OptionT
@stew should the |
@ceedubs I believe as it currently stands, the MonadCombine instance gets its ap definition from FlatMap: https://github.com/non/cats/blob/master/core/src/main/scala/cats/FlatMap.scala#L29-L30 |
@stew right. I guess what I'm saying is that right now there is no test coverage on |
I guess. I can tell you with near certainty that the ap method there, which I implemented with flatmap, will be consistent with flatmap. Another option is to remove ap from OptionT. I'm not sure the circumstance when someone uses ap that isn't doing so from an applicative instance. |
@stew Removing |
👍 |
checkAll("OptionT[List, Int]", MonadTests[OptionT[List, ?]].monad[Int, Int, Int]) | ||
checkAll("OptionT[List, Int]", MonadCombineTests[OptionT[List, ?]].monad[Int, Int, Int]) | ||
checkAll("OptionT[Validated, Int]", ApplicativeTests[Validated[String,?]].applicative[Int, Int, Int]) | ||
checkAll("Functor[Map[String,Int]]", FunctorTests[Map[String,?]].functor[Int, Int, Int]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this test here? (does not use OptionT
)
oops, get rid of tests I didn't intend to add
Test OptionT Functor
👍 |
admit weaker typeclass instances for OptionT when the wrapped Functor…
… is weaker