object o_O extends App { import shapeless._, ops.coproduct._ type ** = Int :+: String :+: Boolean :+: CNil implicit def *>[?](x: ?)(implicit %% : ** Inject ?) = %%(x) def ?=>(x: **) = x unify match { case n: Int => n case s: String => s.length case b: Boolean => if (b) 1 else 0 } def +?(x: (**)*) = x map ?=> reduce (_ + _) // +?(1,"hello", true, 2.0) // Compiler forbids: Wrong type: 2.0 : Double println { +?(1, "hello", true)) // 7 } }