def someFunction[A](list: List[A]): List[A] =
  list match {
    case Nil => sys.error("empty list")
    case Cons(_, t) => t
  }
someFunction(List(1))
Assuming the following code is available for your reference
sealed trait List[+A]
case object Nil extends List[Nothing]
case class Cons[+A](head: A, tail: List[A]) extends List[A]
    
Login in to like
Login in to comment