Reclusive implicit resolution

Let's get a big picture understanding of what the members of the MapToDouble companion object look like:

object MapToDouble {  type Aux[L <: HList, LR <: HList] = MapToDouble[L] { type Result = LR }  def apply[L <: HList](implicit m: MapToDouble[L]) = m  implicit def hcons[H, T <: HList, TR <: HList](implicit    td: ToDouble[H]  , md: MapToDouble.Aux[T, TR]  ): Aux[H ::: T, Double ::: TR]  implicit def hnil[H <: HNil]: MapToDouble.Aux[H, HNil]}

So as you can see, we have an Aux type, and apply function definitions, which are common for the type class pattern. Also, we have two implicit members, which define implementations for the MapToDouble type class for hlist. Since there are two possible instances of hlist, we have ...

Get Mastering Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.