For shapeless.Replacer
information about actual element type should be available in compile time. There is no element of type Bibby
in Bibbies
, so there is nothing to replace.
You should use a generic type for b
, and also you should add required Replacer[Bibbies, B, B]
as implicit parameter like this:
def update[B <: Bibby](b: B, bibbies: Bibbies)(implicit r: Replacer[Bibbies, B, B]) =
bibbies.updatedElem(b)
update(LittleBibby(3), defaultBibbies)
// LittleBibby(3) :: BigBibby(beep) :: HNil