cats-effect
cats-effect copied to clipboard
Add `FiberLocal.Make`
trafficstars
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:
object FiberLocal {
trait Make[F[_]] {
def make(a: A): F[FiberLocal[F, A]]
}
object Make {
implicit val makeForIO: Make[IO] = ...
implicit def makeForOptionT[F[_]: Make]: Make[OptionT[F, *]] = ...
}
}