Type System for Haskells
Haskell's advanced type system includes features that make illegal states unrepresentable: generalised algebraic data types, type families, rank-n types and kinds. Newtypes wrap values for safety at no runtime cost. These tools are used in libraries and domain models, and they come after the basics are comfortable.
Stage: Advanced Types · Part of the Haskell roadmap · Last reviewed 19 November 2026
What to learn in Type System
- Wrap a value in a newtype to prevent mixing up units or ids
- Write a GADT so the type of an expression tracks its result
- Explain what a kind is and read signatures like Type -> Type
- Enable language extensions in GHC and understand why they exist
- Use phantom types to encode a state in a type
Type System interview questions
What is the difference between type, newtype and data in Haskell?
type is only an alias with no new identity. newtype creates a distinct type wrapping exactly one value with no runtime overhead. data defines a new algebraic type with any number of constructors and fields, and values are boxed.
What problem do GADTs solve?
GADTs let each constructor specify a more precise result type, so a typed expression language can say that an Add node only combines integers. The compiler then rejects ill-typed terms and removes the need for runtime checks in the evaluator.
Where Type System fits in the Haskell roadmap
Type System belongs to the Advanced Types stage (advanced level). Go deeper.
Other units in this stage
Back to the full Haskell roadmap