Comments (8)
Yep, I would like to see Bifoldable
.
from cats.
It's worth mentioning that Foldable
and Bifoldable
are lawless. We admitted Foldable
anyway due to its usefulness for adhoc polymorphism. Bifoldable
occurs much less frequently in practice, so we might want to carefully consider its inclusion.
from cats.
Foldable
kind of has laws: https://github.com/scalaz/scalaz/blob/series/7.2.x/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazProperties.scala#L369
from cats.
Those only require that foldMap
, foldLeft
, and foldRight
are mutually consistent. They only exist in Scalaz because Foldable
can be implemented in terms of foldMap
or foldRight
. If you pick one as the abstract method and just derive the other, the law simplifies to a unit test of the derived method.
from cats.
Is there consensus here?
So far it seems like @ceedubs and @tpolecat would like to see this and @mpilquist is skeptical?
from cats.
I personally use Bifoldable from Scalaz on a regular basis and would like to have it.
Plus it gives rise to wildly useful things like separate
on MonadPlus.
👍
from cats.
Re: Laws some quick Googling turned up
https://github.com/scalaprops/scalaprops/blob/master/scalazlaws/src/main/scala/scalaprops/scalazlaws/bifoldable.scala /cc @xuwei-k
and
https://github.com/ekmett/bifunctors/blob/master/tests/BifunctorSpec.hs#L169
from cats.
Re-reading this just now, I'm not skeptical of adding Bifoldable
. 👍
from cats.
Related Issues (20)
- Defer could use some additional instances HOT 3
- Split out ComplementedLattice from Heyting typeclass?
- Please remove/deprecate Foldable for Tuples HOT 6
- Seq instance `.foldRight` has performance implications HOT 7
- Add docs url for all functions in Glossary page HOT 8
- Expose FunctionK.liftFunction as a part of the Scala 3 API
- unorderedTraverse throws a Stackoverflow Error HOT 6
- *.txt HOT 1
- `Apply` syntax is allocating HOT 2
- add `sizeIs` method like std-lib to `cats.Reducible` and/or NonEmpty collections HOT 1
- Maybe you are looking for `as`? :) HOT 2
- Fix documentation (or design) of Free Monad
- Type-classes for Prepend (Cons) and Append (Snoc) operations HOT 5
- Scala 3: No given instance of type cats.Applicative[[_] =>> Any] was found for parameter F of method apply in class PurePartiallyApplied
- Unusual EqLaws definition HOT 4
- Outdated Link in Docs - Seeking Guidance for Fix HOT 1
- algebra-core/src HOT 1
- Option size method implicitly selected from UnorderedFoldable HOT 2
- IndexedStateT has superfluous parts HOT 4
- .splitWhen
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cats.