# Scala Level 6: Type System

> Level 6: Type System of the LoWisa Scala course: Generics, Variance, Type Bounds and Advanced Types. 3 lessons and 9 ideas, each explained in one line.

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

## 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

- **Before:** [Level 5: Functional Programming](/courses/scala/level-5-functional-programming/): Higher-Order Functions, Pure Functions and Immutability, Function Composition.
- **Next:** [Level 7: Scala 3 Features](/courses/scala/level-7-scala-3-features/): Givens and Contextual Abstractions, Extension Methods, Modern Scala Design.

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](/help/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.

---

Source: https://lowisa.dev/courses/scala/level-6-type-system/ · Updated 2026-11-30
