Future is largely known to not be referentially transparent. As it starts execution immediately and caches the result.
While it may have been largely necessary for these instances to be in cats before cats-effect, with that solution coming in maturity it may be time for Future instances to be pushed to alleycats.
Imports
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import cats.implicits._
Example 1 - Prints Once on the first line
val future1 : Future[Unit] = Future(println("I printed"))
val futureResult1 : Future[Unit] = (future1, future1).mapN(_ => ())
Example 2 - Prints twice on the second line
def future2: Future[Unit] = Future(println("I printed"))
val futureResult2 : Future[Unit] = (future2, future2).mapN(_ => ())
As you can see we have lost equational reasoning.
What are your thoughts on the future of Future?
Futureis largely known to not be referentially transparent. As it starts execution immediately and caches the result.While it may have been largely necessary for these instances to be in cats before cats-effect, with that solution coming in maturity it may be time for Future instances to be pushed to alleycats.
Imports
Example 1 - Prints Once on the first line
Example 2 - Prints twice on the second line
As you can see we have lost equational reasoning.
What are your thoughts on the future of
Future?