-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathi22423.scala
35 lines (28 loc) · 1.06 KB
/
i22423.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//> using options -Xmax-inlines:7
import scala.deriving.Mirror
import scala.compiletime._
import scala.compiletime.ops.int._
object HintsAwareConfigReaderDerivation {
inline def deriveReader[A]: ConfigReader[A] =
readCaseClass()
???
private inline def summonConfigReader[A]: ConfigReader[A] =
summonFrom { case reader: ConfigReader[A] => reader }
private inline def readCaseClass(): Unit =
summonConfigReader[List[String]]
val a1: Int = ???
val a2: EmptyTuple = ???
a1 *: a2
???
}
trait ConfigReader[A]
object ConfigReader {
implicit def traversableReader[A, F[A] <: TraversableOnce[A]](implicit configConvert: ConfigReader[A]): ConfigReader[F[A]] = ???
implicit def exportedReader[A](implicit exported: Exported[ConfigReader[A]]): ConfigReader[A] = exported.instance
case class Exported[A](instance: A)
}
import ConfigReader._
inline given exportReader[A]: Exported[ConfigReader[A]] = Exported(HintsAwareConfigReaderDerivation.deriveReader[A])
case class Settings(rules: List[String])
val settings =
exportReader[Settings] // error