shapeless: Generic programming for Scala | Latest stable release 2.3.3 | Code of conduct https://www.scala-lang.org/conduct/
milessabin on new-liftp
Use Term.of Avoid clash between scala.runti… Update QuoteContext to Quotes and 13 more (compare)
joroKr21 on master
Update scalajs-junit-test-plugi… Merge pull request #1069 from s… (compare)
def check[A, C <: Coproduct, K <: HList](data: Seq[A])(
implicit
gen: LabelledGeneric.Aux[A,C]
keys: ops.union.Keys.Aux[C,K]
toList: ops.hlist.ToTraversable.Aux[K,List,Symbol]
): List[(String,Boolean)] = {
val classes: List[Symbol] = toList(keys())
classes.map(sym => (sym.name, data.exists(_.getClass.getSimpleName == sym.name)))
}
Int
-> Double
and Int
-> String
. Is this correct? Or am I using the library incorrectly?
Rel[Int, Double]
and Rel[Int, String]
, and you do get(1)
, how will the typesystem know whether the value is of type Double
or String
?
vault
library for a similar abstraction with different constraints
Key[A]
, and then you can get the corresponding value
implicit ev: SelectAll[H,I]
to ensure all members of I
are in H
.
implicit ev: IsHCons[I]
to ensure that I
is not empty.
def foo[H <: Hlist, I <: HList](xs: H, ys: I)(implicit ev: SelectAll[H,I], ev2: IsHCons[I]): Unit = {
println(xs.select[ev2.H])
}
ev2.H
is in H
.
SelectAll
does not guarantee order, so SelectAll[H, I]
does not provide proof that IsHCons[I]
is equal to IsHCons[H]
.
ev2.head(xs)
because while they have the same types, it’s not given that the head of H
is the same type as head of I
. It could be a type not existing in I
, or one of the types in the tail of I
. And if you wanna do xs.select
, you need to provide a Selector
instance for it.
A -> B
and A -> C
then by definition it's not a mapping
A ->
map to, at the type level?
B
or C
?
A -> B
and A -> C
, how is that a mapping?
Boolean
and the value "b" to the type Int
If I have a recursively-resolved typeclass like this:
trait Foo[A] {
type Repr
def to: Repr
}
With at most one instance for a given A
. Is there a way to write an instance summoner that looks something like this:
def instance[A](implicit foo: Foo.Aux[A,R]): R = ???
? And if so, will the compiler correctly infer the concrete type rather than some Foo.Aux…
type?