4

I want do do some programming that needs effects ( who doesn't :-). In particular something like scalaz Task to run some asynchronous data retrieval and ruturn a Future like effect that will handle the resuts on completion.

I notice that typelevel Cats now has the Effect Monad but also there is the typelevel eff Monad project. Both of which are for dealing functionally with effects. So now I have a choice of where to invest my time and I'm confused.

  • Which should I use?
  • Is there some underlying ethos or intent of each library that will guide my choice?
  • What is each library for?
  • What problem does it solve?

Or can I just use both eg wrap cats.Effect in an eff FutureEffect or TaskEffect. Is that even a good idea?

Thanks

Karl
  • 1,164
  • 9
  • 25

1 Answers1

5

Even though their names are somewhat similar the purpose of the two projects is entirely different.

The purpose of cats-effect is to provide a principled/standard IO type for Scala (+ some other related typeclasses), a way to abstract over it (e.g. Sync, Async, etc.) and improve interoperability & composability between 3rd party libraries.

The purpose of Eff is to provide an alternative to the monad transformer (mtl) style of programming. It doesn't necessarily deal with IO/Task and the like, but provides a cleaner way to stack effects (for example if you need to compose Reader + State + Writer effects doing it manually can become painful).

From your description:

In particular something like scalaz Task to run some asynchronous data retrieval and ruturn a Future like effect that will handle the resuts on completion.

It seems like what you need would be better served by cats-effect.

Denis Rosca
  • 3,409
  • 19
  • 38