(note: split shapeless: trying restrict hlist elements type , shapeless: own hlist constraint using coproduct )
question 3 - restrict case classes parameter types
a nice additional gain be, if use hlist constraints constrain case class built anyvals, strings, , specific mybasetrait, recursively fulfill same constraint. constraint being defined on base trait , not have touch derived case class great. like:
trait mybasetrait type mycp = boolean :+: long :+: ... :+: string :+: mybasetrait case class validsimple(b: boolean, s: string) extends mybasetrait case class validnested(s: string, vs: validsimple) extends mybasetrait case class notofbasetrait(l: long) case class invalidnested(s: string, vs: notofbasetrait) extends mybasetrait // => compile error
this allow fail lot earlier. possible? via generic#repr or deephlist?
Comments
Post a Comment