title: What does not compile?
body: <p>I have a trait as follow:  </p>
  
  <pre><code>sealed trait Option[+A] {
  
    def map[B](f: A =&gt; B): Option[B] = this match {
      case None =&gt; None
      case Some(a) =&gt; Some(f(a))
    }
  
  }
  
  case class Some[+A](get: A) extends Option[A]
  case object None extends Option[Nothing]
  </code></pre>
  
  <p>When I try to compile I've got following error:</p>
  
  <pre><code>scala&gt; :load "src/Option.scala"
  Loading src/Option.scala...
  src/Option.scala:17: error: pattern type is incompatible with expected type;
   found   : None.type
   required: Option[A]
             case None =&gt; None
                  ^
  src/Option.scala:17: error: type mismatch;
   found   : None.type
   required: Option[B]
             case None =&gt; None
                          ^
  src/Option.scala:18: error: constructor cannot be instantiated to expected type;
   found   : Some[A(in class Some)]
   required: Option[A(in trait Option)]
             case Some(a) =&gt; Some(f(a))
                  ^
  src/Option.scala:18: error: type mismatch;
   found   : Some[B]
   required: Option[B]
             case Some(a) =&gt; Some(f(a))
                                 ^
  src/Option.scala:11: error: illegal inheritance from sealed class Option
         case class Some[+A](get: A) extends Option[A]
                                             ^
  src/Option.scala:11: error: illegal inheritance from sealed class Option
         case object None extends Option[Nothing]
  </code></pre>
  
  <p>Why?  </p>
  
  <p>I am new in scala world and can not differ if the <code>map</code> is function or a method? How can I use map?</p>