summaryrefslogtreecommitdiff
path: root/sources/scala/Nil.scala
blob: 508440b7e763e1a3f6701a1258cf06ff5100a030 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
package scala {

  /* An empty list. Scala provides <code>[]</code> as syntactic sugar
  * for <code>Nil</code>.
  */
  final case class Nil[c]() extends List[c] with {
    def isEmpty = True;
    def head: c = error("head of empty list");
    def tail: List[c] = error("tail of empty list");
    override def toString(): String = "[]";
  }
}