Replies: 1 comment 1 reply
-
As a data point in my WIP PR to update the ZIO interop I pass it implicitly: zio/interop-cats#263 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Following from the discussion around here: https://gitter.im/typelevel/cats-effect-dev?at=5ff7526f9632f63d8701e59f
We've had more than one conversation on this subject, but haven't come to a consensus yet.
The short version of it is:
Currently the
Dispatcher
code encourages you to pass it explicitly: there's noapply
summoner, and there's no code samples or documentation showing it passed implicitly.Most of the time, you can get away with constructing and then immediately using
Dispatcher
, but there are use cases where that's undesirable - any time you need to implement a method that returns a non-effect type, you'll need to take it as an input.An example would be the API for
streamz
, which is my personal area of concern for this:https://github.com/krasserm/streamz/blob/master/streamz-examples/src/main/scala/streamz/examples/converter/Example.scala#L68-L69
My opinion is that guiding users to pass it explicitly is worse for user experience; I think it's vastly likely that folks will want to have cases where they take in a Dispatcher. Forcing it to be explicit would introduce a barrier to them adopting CE3. I think it's likely a lot of production CE2 codebases out there will want as much of a minimal transition as possible, and Dispatcher being "blessed" as passed implicitly will help them reduce the effort needed, since many of the use cases are covered by things that previously were implicit (mainly ConcurrentEffect)
Beta Was this translation helpful? Give feedback.
All reactions