Open zarthross opened 3 months ago
@bplommer Thoughts?
This is definitely something I think would be good to have. What sort of API do you envisage? I guess the core functionality would be a pair of methods for converting between Circe's Json
and LD's LDValue
(and that would be a good start for sure) but it feels a bit clumsy still - maybe a pair of extension methods like toCirce
and toLDValue
would make it nicer to work with, what do you think?
I thinking along the lines of extension methods for LaunchDarklyClient[F]
implicit class LaunchDarklyClientExt[F[_]: Monad](private val client: LaunchDarklyClient[F]) {
def circeValueVariation[Ctx: ContextEncoder, A: Encoder: Decoder](
featureKey: String,
context: Ctx,
defaultValue: A,
): F[Decoder.Result[A]] = ???
or Just
implicit class LaunchDarklyClientExt[F[_]: MonadThrow](private val client: LaunchDarklyClient[F]) {
def circeValueVariation[Ctx: ContextEncoder, A: Encoder: Decoder](
featureKey: String,
context: Ctx,
defaultValue: A,
): F[A] = ??? // Lift the decoder failure into F
Would y'all be open to a circe module for json variation to make it easier to work with Json?