Can’t prove that singleton types are singleton types while generating type class instance
This works as written as of the most recent shapeless 2.1.0-SNAPSHOT.
This works as written as of the most recent shapeless 2.1.0-SNAPSHOT.
Addressing questions one to three: one of the main applications for HLists is abstracting over arity. Arity is typically statically known at any given use site of an abstraction, but varies from site to site. Take this, from shapeless’s examples, def flatten[T <: Product, L <: HList](t : T) (implicit hl : HListerAux[T, L], flatten … Read more
In general, the element types of a tuple aren’t the same, so map doesn’t make sense. You can define a function to handle the special case, though: scala> def map[A, B](as: (A, A))(f: A => B) = as match { case (a1, a2) => (f(a1), f(a2)) } map: [A,B](as: (A, A))(f: (A) => B)(B, B) … Read more
Syntactic convenience aside, the combination of singleton types, path-dependent types and implicit values means that Scala has surprisingly good support for dependent typing, as I’ve tried to demonstrate in shapeless. Scala’s intrinsic support for dependent types is via path-dependent types. These allow a type to depend on a selector path through an object- (ie. value-) … Read more