For the below method, is it possible to somehow encode the information in types that makes sure that the length of the input list and the returned list is the same?
def addOne(list: List[Int]): List[Int]
For the below method, is it possible to somehow encode the information in types that makes sure that the length of the input list and the returned list is the same?
def addOne(list: List[Int]): List[Int]
Instead of List
you can use shapeless.Sized
or shapeless.HList
in Scala 2 or tuple in Scala 3.
Thanks! Can you point me towards how I should go about with the Scala 3 tuple implementation?