-
-
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
#500 add derived foldMap from traverse law #502
Conversation
@non could it be related to the limitation of |
|
@julien-truffaut Correct. Once we have a new ScalaCheck release we will start getting real functions which actually depend on their input. |
@non so what do you recommend to do?
|
@julien-truffaut I guess I would say we should do (1). To me that seems like the best path, and will avoid duplicate (or redundant) work. But I'm fine with any of these to be honest. |
I went for (2) but only I could fix |
OK, I'll take a look. |
@julien-truffaut I was perplexed by the discrepancy between the traverse/const and foldMap for List, and I realized that our implementation of Cats: scala> val x = Const[List[Int], String](List(1)) ap Const[List[Int], String => String](List(2))
x: cats.data.Const[List[Int],String] = Const(List(1, 2)) Scalaz: scala> val x = Const[List[Int], String](List(1)) <*> Const[List[Int], String => String](List(2))
x: scalaz.Const[List[Int],String] = Const(List(2, 1)) |
@ceedubs I also noticed some interesting order issues in the monoidal branch I'm working on. |
flashback to #142 |
@ceedubs no I didn't notice. It seems that haskell use the same order than cats http://hackage.haskell.org/package/base-4.8.1.0/docs/src/Control.Applicative.html#line-84 |
@julien-truffaut I think Haskell's is actually the opposite of Cats. It looks the same because the value from the first const is "prepended" to the value from the second const. However, the function argument comes first in Haskell while it comes second in Cats. I think that it makes sense to have the function come first in Haskell but last in Scala, due to differences in the languages. However, it does mean that the version of |
@ceedubs maybe I missed something but it seems to me that haskell behave in the same way than cats
|
some additional background of scalaz impl: scalaz/scalaz@084e9c9#commitcomment-13182666 |
…ed arguments compared to haskell
@ceedubs found out exactly what was the issue! |
Current coverage is
|
👍 |
Sorry for the new merge conflicts. If this gets updated I'm happy to see it merged. Thanks! |
👍 from me once merge conflicts resolved (and Travis is green light) |
What @adelbertc said ^ |
#500 add derived foldMap from traverse law
I probably missed something in the definition of the law because they all pass but a simple test shows that it is not the case for
List