Scala course

Scala Level 6: Type System

Type System is level 6 of 13 of the LoWisa Scala course. It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

Updated 2026-11-30

Generics

  • Type parameters. Generics parameterise classes and methods: Box[A], checked at compile time, erased at runtime.
  • Context bounds. A context bound: [A: Ordering]: demands a capability alongside the type.
  • Higher-kinded awareness. Higher-kinded types abstract over containers: F[_]: the shape libraries like effect systems build on.

Variance

  • Covariance. +A marks covariance: a List of Cats is a List of Animals, safely, because Lists only produce.
  • Contravariance. -A marks contravariance: a handler of Animals handles Cats: consumers flip the arrow.
  • Variance in APIs. Variance annotations are API promises: the compiler rejects designs that would lie.

Type Bounds and Advanced Types

  • Bounds. Upper and lower bounds: A <: Animal: relate type parameters to hierarchies.
  • Opaque types. opaque types wrap primitives at zero cost: UserId that cannot be confused with String.
  • Union and intersection types. Scala 3 adds union (A | B) and intersection (A & B) types: precise signatures without wrappers.

Before and after this level

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.

Frequently asked questions

What does Scala Level 6: Type System cover?

Generics, Variance, Type Bounds and Advanced Types: 3 lessons and 9 ideas.

What should I know before this level?

The level before it, Level 5: Functional Programming, which covers Higher-Order Functions, Pure Functions and Immutability, Function Composition.

Learn Scala on your phone

The first level is free. LoWisa is on Google Play and the App Store.