I attempted to solve a simplification of User Story 2 using shapeless:Namely, define the implementation of:trait IsValid[A]object IsValid {  def apply[L <: HList](implicit ev: IsValid[L]) = ev}where valid means (per my simplification):given 2 digits, it's valid if (A * 1 + b * 0) mod 5 == 0So, (5, 0) is valid since (5*1) + (0*0) mod 5 == 0 is true.But, (4, 1) is not since it does not satisfy the above equation.Here's my full implementation:package netimport shapeless._, ops.hlist.IsHConsimport nat._import ops.nat.{ Mod, Prod, Sum }trait IsValid[A]object IsValid {  // simplified: given 2 digits, it's valid if (A * 1 + b * 0) mod 5 == 0  def apply[L <: HList](implicit ev: IsValid[L]) = ev  implicit def validNumber[L <: HList, H <: HList, A <: Nat, B <: Nat,                 P1 <: Nat, P2 <: Nat, S <: Nat](     implicit evA: IsHCons.Aux[L, A, H],     evB: IsHCons.Aux[H, B, HNil],     prod1: Prod.Aux[_1, A, P1],     prod2: Prod.Aux[_0, B, P2],     sum: Sum.Aux[P1, P2, S],     mod: Mod.Aux[S, _5, _0]   ): IsValid[L] = new IsValid[L] {}}Testing:// (5*1) + (10*0) mod 5 === 0 (true)scala> IsValid[_5 :: _10 :: HNil]res4: net.IsValid[shapeless.::[shapeless.nat._5,shapeless.::[shapeless.nat._10,shapeless.HNil]]] = net.IsValid$$anon$1@160627b3// (10*1) + (10*0) mod 5 === 0 (true)scala> IsValid[_10 :: _10 :: HNil]res5: net.IsValid[shapeless.::[shapeless.nat._10,shapeless.::[shapeless.nat._10,shapeless.HNil]]] = net.IsValid$$anon$1@3f3f03a3// (3*1) + (10*0) mod 5 === 0 (false)scala> IsValid[_3 :: _0 :: HNil]<console>:19: error: could not find implicit value for parameter ev: net.IsValid[shapeless.::[shapeless.nat._3,shapeless.::[shapeless.nat._0,shapeless.HNil]]]       IsValid[_3 :: _0 :: HNil]              ^// 3 digits are not allowed, only 2scala> IsValid[_5 :: _0 :: _1 :: HNil]<console>:19: error: could not find implicit value for parameter ev: net.IsValid[shapeless.::[shapeless.nat._5,shapeless.::[shapeless.nat._0,shapeless.::[shapeless.nat._1,shapeless.HNil]]]]       IsValid[_5 :: _0 :: _1 :: HNil]              ^Please critique my approach.
Simplified Kata of BankOCR using Shapeless
scala