Skip to content

Instantly share code, notes, and snippets.

@milessabin
Created September 12, 2016 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milessabin/2cc749c84e504876cb6e9507993fa7c4 to your computer and use it in GitHub Desktop.
Save milessabin/2cc749c84e504876cb6e9507993fa7c4 to your computer and use it in GitHub Desktop.
scala> def stuff(xs: ::[Int]): Int = xs.head
stuff: (xs: ::[Int])Int
scala> stuff(Nil)
<console>:13: error: type mismatch;
found : scala.collection.immutable.Nil.type
required: ::[Int]
stuff(Nil)
^
scala> stuff(::(1, ::(2, ::(3, Nil))))
res0: Int = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment