Ok, I figured it out. The change is really simple:
type ConsArguments = (Option[Long], String, Option[String], Iterable[Input])
trait Type {
val name :String
type Value
val tpe :universe.Type
def apply(id :Option[Long], name :String, label :Option[String], inputs :Iterable[Input]=Iterable()) :Statistic
}
class BaseType[V :TypeTag](val name :String, constructor :((ConsArguments)) => Statistic {type Value=V}) extends Type{
type Value = V
val tpe = typeOf[V]
def apply(id :Option[Long], name :String, label :Option[String], inputs :Iterable[Input]=Iterable()) :Statistic{type Value=V} =
constructor((id, name, label, SortedSet[Input]()(Input.nameOrdering)++inputs))
}
val LongValued = new BaseType[Long]("long", (LongStatistic.apply _).tupled)
val lv :Type = LongValued
println("type of lv: "+lv.tpe+" is Long? "+(lv.tpe=:=universe.typeOf[Long]))
Still, a bit annoying to have double (type ... and val _ :Type) declaration all over the code.