-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FiberLocal.Make
#1821
Comments
I'm definitely not a fan of this. The problem is that this is a false abstraction: fiber locals in other |
@djspiewak Not sure if you caught it in the PR, but I ended up parameterizing |
Uh. Hmm. I'll need to think about it a bit. I really don't think it's going to be something we want to abstract over, but I see what you're saying about binary compatibility. |
My original thinking was that our definition of |
We definitely don't have copy-on-fork in monix. We opted for making user isolate region explicitly to have CE2 laws like |
Related: #1847 |
Is Monix support still a blocker for having an official |
I think it's less a question of what implementations do exist and more a question of what implementations could exist. The blocker is that there isn't an argument why one particular semantic should be preferred for an abstraction. Taking a step-back, what is your use-case? Is it possible that the |
I do think Cats MTL I suppose I could hack one together up and create one for trait GenMTLLocal[F[_]]{
def local[A](default: A): F[Local[F, A]]
}
object GenMTLLocal {
implicit def ioLocal: new GenMTLLocal[IO] {
def local[A](default: A): IO[Local[IO, A]] = IOLocal(default).map(oxidized.instances.catsMtlEffectLocalForIO)
}
} |
Not every effect monad implements both |
I'm sorry, I think we talked past each other. My point was that we don't create abstractions by selecting the semantics of an existing implementation and simply swapping in an To frame this issue another way: what is the (theoretical) reason that we should choose the copy-on-fork semantic for this abstraction, independent of what implementations are doing? |
Follow-up to #1393.
I think users will likely want to create fiber locals for an abstract effect. We can surely create them in IO and other effects that have this functionality, it is probably possible for monad transformers too (I might be missing something).
It would be great to have an abstraction for this that people can depend on instead of sticking to IO:
The text was updated successfully, but these errors were encountered: