Code Monkey home page Code Monkey logo

Comments (5)

mpilquist avatar mpilquist commented on July 18, 2024

Note the 2.11 behavior matches that of Future.traverse (https://scastie.scala-lang.org/aU1EoSBnQu2rbWiXtEbcsQ)

from cats.

yurique avatar yurique commented on July 18, 2024

Right, it does 🤔.
But it doesn't match the traverse with IO: https://scastie.scala-lang.org/1JfGkbQOSTicrUyPaERQhw

Regardless, it still looks like a very breaking change.

from cats.

armanbilge avatar armanbilge commented on July 18, 2024

it still looks like a very breaking change

looks like, but is not. See previous discussion:

from cats.

johnynek avatar johnynek commented on July 18, 2024

The problem is Future, and hence this function test: Int => Future[Unit] is not pure.

When you call test a side effect immediately starts. That is not true of the IO version. When you are working with Future you are working with an impure type and we don't limit the traverse implementation of data types to try to work that.

A PR was created where a lot of energy was spent to optimize traverse implementations: #4498 -- I think it is very likely the change you are seeing is due to that.

I guess what is happening is that since Future has a StackSafeMonad, it is traversing directly (which is what the standard library does), but that is triggering the side-effects in a different order.

from cats.

yurique avatar yurique commented on July 18, 2024

looks like, but is not

It depends on how you look at it (or how much code you need to fix) 😆.


Thanks for chiming in, everyone! I'll close this one and will go hunting down my traverses :)

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.