title: Scala Either with List
body: <p>I wanted to implement a similar type called <code>Result</code> to the <code>Either</code> type. The main difference is, that the Left side of the <code>Result</code> type should always be a List of something. What would be the right type definition for this? I tried having something like that:</p>
  
  <pre><code>sealed trait Result[List, +A] {
      def map[B](f: A =&gt; B): Result[List, B] = this match {
          case Failure(err) =&gt; Failure(err)
          case Success(value) =&gt; Success(f(value))
      }
      def apply[B](f: Result[List, A =&gt; B]): Result[List, B] = (f, this) match {
          case (Failure(fE), Failure(aE)) =&gt; Failure(fE ::: aE)
          case ...
      }
  }
  
  final case class Failure[+E](errors: List[E]) extends Result[List[E], Nothing]
  final case class Success[+A](value: A) extends Result[Nothing, A]
  </code></pre>
  
  <p>But this runs in an error in the map function saying <code>Failure[Any] does not equal Result[List, B]</code> and <code>Success[B] does not equal Result[List, B]</code>. Is the type definition <code>Result[List, +A]</code> already wrong, should I use a higher-kinded type like <code>List[_]</code> instead?</p>