Code Monkey home page Code Monkey logo

Comments (8)

tpolecat avatar tpolecat commented on May 16, 2024

Yep, I would like to see Bifoldable.

from cats.

mpilquist avatar mpilquist commented on May 16, 2024

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.

adelbertc avatar adelbertc commented on May 16, 2024

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.

mpilquist avatar mpilquist commented on May 16, 2024

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.

non avatar non commented on May 16, 2024

Is there consensus here?

So far it seems like @ceedubs and @tpolecat would like to see this and @mpilquist is skeptical?

from cats.

coltfred avatar coltfred commented on May 16, 2024

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.

adelbertc avatar adelbertc commented on May 16, 2024

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.

mpilquist avatar mpilquist commented on May 16, 2024

Re-reading this just now, I'm not skeptical of adding Bifoldable. 👍

from cats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.