cats-effect
cats-effect copied to clipboard
Add `snapshot` to `MapRef`
trafficstars
Motivation
MapRef can be considered as a replacement for Ref[F, Map[K, V]]. However, currently, there is no way to retrieve all available values.
Why not add snapshot method directly to the MapRef trait?
Two reasons:
- We cannot implement
snapshotfor thedef fromSeqRefs[F[_]: Functor, K, V](traverserequiresApplicative) - For the majority of the implementations, the result type would be
Map[K, Option[V]], which is suboptimal