Scala Typeclasses with generics -
i've been playing typeclass pattern in scala, haven't been able figure out how implement implicit companion object when type i'm working generic. for example, let's i've defined trait typeclass provides functions putting things box es. case class box[a](value: a) trait boxer[a] { def box(instance: a): box[a] def unbox(box: box[a]): } implicit object intboxer extends boxer[int] { def box(instance: int) = box(instance) def unbox(box: box[int]) = box.value } def box[a : boxer](value: a) = implicitly[boxer[a]].box(value) def unbox[a : boxer](box: box[a]) = implicitly[boxer[a]].unbox(box) this works expected, allowing me provide implementations of boxer various types. however, have no idea how when type wish act on generic itself. let's wanted able use boxer on seq[a] . object s in scala cannot include type parameters, i'm @ loss go: // not compile - object cannot have type arguments implicit object seqboxer[a] extends boxer[seq[a]] { ..