Key Scala terms organized alphabetically. For detailed explanations, refer to the Concepts section. Each term includes a definition and links to related documentation.

TL;DR - Top 5 Terms
  • Case Class: Immutable data class, auto-generates equals/copy
  • Option[A]: Replacement for null, either Some(value) or None
  • Pattern Matching: Structure analysis and data extraction (match expressions)
  • Trait: Interface that can include implementations, supports mixin inheritance
  • given/using (Scala 3): New syntax for implicit values/parameters

A#

ADT (Algebraic Data Type)
Algebraic data types. Combination of sum types and product types defined with sealed trait and Case Class. Can be defined more simply with enum in Scala 3. → Used with Pattern Matching
Applicative
A Type Class that combines independent effects. Provides pure and ap operations. More powerful than Functor, weaker than Monad. → Functional Patterns
apply method
A special method that allows objects to be called like functions. obj(args) is interpreted as obj.apply(args). Commonly used as a factory method in Companion Object.

C#

Case Class
A special class for immutable data. Automatically generates equals, hashCode, copy, unapply, etc. Used with Pattern Matching. → Case Classes Details
Companion Object
A singleton object with the same name as a class. Can access the class’s private members. Implements factory pattern with apply method. → Classes and Objects
Context Bound
Syntax requiring the existence of a Type Class instance, like def f[A: Ordering]. → Implicits
Currying
A technique for transforming a function with multiple arguments into a chain of single-argument functions. Used with Higher-Order Function. → Functions and Methods
A-C Key Points
  • ADT: Type-safe data modeling with sealed trait + case class
  • Case Class: Optimized for immutable data, used with pattern matching
  • Companion Object: Place for factory methods (apply) and utility functions

E#

Either[L, R]
A type that holds one of two types. Usually Left is failure, Right is success. Similar to Option but can contain failure information. Can be chained with flatMap.
Extension Method
A technique for adding new methods to existing types. Use extension keyword in Scala 3. Used in Type Class implementations. → Scala 3 Feature Comparison
ExecutionContext
Context providing a thread pool for executing Future. → Concurrency

F#

flatMap
An operation that transforms values inside a container and flattens the result. Core operation of Monad. Can be elegantly expressed with For Comprehension.
For Comprehension
Syntactic sugar for elegantly expressing combinations of flatMap, map, and withFilter. Used with Option, Future, Either, etc. → For Comprehension Details
Functor
A Type Class with a map operation. Transforms values inside a container. Foundation of Applicative and Monad. → Functional Patterns
Future[T]
A type representing an asynchronous computation not yet completed. Requires ExecutionContext. Sequential execution possible with For Comprehension. → Concurrency

G#

Given (Scala 3)
Keyword for defining Type Class instances. Replaces Scala 2’s implicit val. → Scala 2 vs 3 Comparison

H#

Higher-Order Function
A function that takes functions as arguments or returns a function. Examples: map, filter, fold. → Higher-Order Functions Details
Higher-Kinded Type
A type that takes type constructors as arguments. Form of F[_]. Essential for defining Functor and Monad. → Advanced Type System

I#

Immutable
Something whose state cannot be changed after creation. Scala recommends immutability. Use Case Class, val, and immutable collections.
Implicit (Scala 2)
Keyword for defining implicit values, parameters, and conversions. Replaced by given/using in Scala 3. → Implicits Details
Intersection Type (&)
A type satisfying multiple types. A & B. Opposite of Union Type. → Advanced Type System
E-I Key Points
  • Either/Option: Used instead of null, functional approach to error handling
  • flatMap: Core of Monad, elegantly expressed with for comprehension
  • given/using (Scala 3): Clear syntax replacing implicit

L#

Lazy val
A value whose initialization is deferred until first access. Useful for expensive initialization. → Basics

M#

Match Expression
An expression that branches based on value patterns. Powerful version of switch. Optimized for Case Class and Sealed traits. → Pattern Matching Details
Monad
A Type Class with flatMap and pure operations. Composes sequential effects. Option, Either, Future are Monads. → Functional Patterns

O#

Object
Keyword for defining singleton instances. See Companion Object. → Classes and Objects
Opaque Type (Scala 3)
A type that appears different externally but is identical to its base type internally. Type safety without runtime overhead. → Scala 3 Feature Comparison
Option[A]
A type representing the presence (Some) or absence (None) of a value. Replacement for null. Safely handled with flatMap and For Comprehension. → Basics
L-O Key Points
  • lazy val: Defers expensive initialization until first use
  • Monad: flatMap + pure, core abstraction for sequential effect composition
  • Option: Type-safe handling with Some/None instead of null

P#

Partial Function
A function defined only for some inputs. Same form as Pattern Matching cases. Used with the collect method. → Functions and Methods
Pattern Matching
A technique for analyzing value structure and extracting data. Used with Case Class and Sealed traits. → Pattern Matching Details
Promise[T]
A type allowing direct completion of a Future. Used for wrapping callback-based APIs. → Concurrency

R#

Referential Transparency
The property that replacing an expression with its result value doesn’t change program meaning. Key characteristic of pure functions. Related to Immutable data. → Functional Patterns

S#

Sealed
A modifier restricting inheritance to the same file only. Used for Pattern Matching exhaustiveness checking. Essential for ADT definitions. → Pattern Matching
Singleton Object
A unique instance defined with the Object keyword. See Companion Object.
summon (Scala 3)
A function to retrieve an implicit instance of a given type. Replaces implicit implicitly. → Type Classes

T#

Tail Recursion
Recursion where the last operation is a call to itself. Can be optimized without stack overflow. Verified with @tailrec annotation. → Functions and Methods
Trait
Similar to Java interfaces but can include implementations. Supports mixin inheritance. Forms ADT with Sealed. → Classes and Objects
Try[T]
A type containing the result of a computation that may throw exceptions. Either Success or Failure. Similar error handling pattern to Either and Option. → Basics
Type Class
A pattern for adding functionality to existing types. Implements ad-hoc polymorphism. Representative examples: Functor, Monad. → Type Classes Details
Type Inference
The compiler’s ability to automatically infer types. Scala’s powerful type inference reduces boilerplate. → Basics
P-T Key Points
  • Pattern Matching: Destructure data structures and branch with match expressions
  • Sealed: Restricts inheritance to same file, enables pattern matching exhaustiveness checking
  • Type Class: Add functionality to existing types, implement ad-hoc polymorphism

U#

Union Type (|)
A type representing one of multiple types. Int | String. Opposite of Intersection Type. Scala 3 only. → Advanced Type System
Using (Scala 3)
Keyword for declaring implicit parameters. Replaces Implicit. Pairs with Given. → Scala 2 vs 3 Comparison

V#

val
Keyword for declaring Immutable values. Compare with var. Default choice in Scala.
var
Keyword for declaring mutable variables. Less recommended than val. → Basics
Variance
Subtyping relationship of type parameters. Covariant (+A), contravariant (-A), invariant. Important for collection design. → Variance Details

Y#

yield
Keyword for generating values in For Comprehension. Transformed to map calls. → For Comprehension Details
U-Y Key Points
  • Union Type (|): Scala 3 only, concise type expression instead of Either
  • val/var: Prefer val (immutable), minimize var (mutable)
  • Variance: Define type relationships with covariant (+A), contravariant (-A)

Next Steps#