Skip to content
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

Circe module for json variation #135

Open
zarthross opened this issue Jul 25, 2024 · 3 comments
Open

Circe module for json variation #135

zarthross opened this issue Jul 25, 2024 · 3 comments

Comments

@zarthross
Copy link
Contributor

Would y'all be open to a circe module for json variation to make it easier to work with Json?

@zarthross
Copy link
Contributor Author

@bplommer Thoughts?

@bplommer
Copy link
Collaborator

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?

@zarthross
Copy link
Contributor Author

zarthross commented Aug 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants