zio / zio-config

Easily use and document any config from anywhere in ZIO apps
https://zio.dev/zio-config
Apache License 2.0
231 stars 112 forks source link

Support for opaque types #1391

Open andreoss opened 5 months ago

andreoss commented 5 months ago

Can DeriveConfig work with opaque types?

opaque type Template = String

object Template:
  import zio.*
  import zio.config.magnolia.*

  private def compile(v: String): Template = ???
  def apply(v: String): Template           = compile(v)

  given DeriveConfig[Template] = DeriveConfig[String].map(Template(_)) // Infinite loop here