We added short-circuting for Vector and List in #3446, but it's still missing a few others, namely:
I can look into this if that's ok.
@barambani please by all means do 馃槉
I have a couple of questions about this. Now that there's a combineKEval I was wondering if changing the foldMapK in Foldable to
def foldMapK[G[_], A, B](fa: F[A])(f: A => G[B])(implicit G: MonoidK[G]): G[B] =
foldRight(fa, Eval.now(G.empty[B])) { (a, evalGb) =>
G.combineKEval(f(a), evalGb)
}.value
instead of specializing it in the instances would break any assumption (the tests and Mima checks pass). It would delegate the short circuiting behavior to the MonoidK for any implementation, so it looks more general.
Also, the way the ShortCircuitingLaws and relative tests are currently seems to differ from the organization of cats.laws. It seems they could be part of the Foldable, Traverse and TraverseFilter laws/tests. Any reason why they are in a separate file ?
More than happy to proceed in any way. Thanks.
@barambani great catch, I think that should be fine if it passes the ShortCircuitingTests.
I'm not exactly sure what the reasoning is for it not being part of the more general laws, but it's possible that some people don't care about the short-circuiting and just want to have the "standard" laws checked.
We could however make the foldable laws the parent of the traverse laws in ShortCircuitingTests. Hope that answers your questions.
Makes sense. Thanks a lot :).
Most helpful comment
@barambani please by all means do 馃槉