Featured Types

The Scala ecosystem has several types that may not be immediately familiar to you, but that are extremely useful to know. Here are three very important ones, since they are used throughout the core Scala API and many external libraries:

  1. Option
    Scala uses the Option type instead of null to represent non-existence of values. This article explains options very well (and uses the term "hipsterrific startups", which shows profound wisdom)
  2. Try
    There are no checked exceptions in Scala, but we can still use try-catch blocks to handle them. However, the Try data structure offers a way to express possible errors within the type system. Daniel Westheide explains Try in this article.
  3. Either
    In some scenarios, it's useful to create a container that wraps around values of two possibly unrelated types. This is where Either can be helpful. This blog post explains the Either structure very well.

Take a moment to complete the quiz below to make sure you've understood Featured Types.