Type family
A type family is a collection of types whose members or resulting type are determined by one or more indices or input types.
Type-Driven Development with Idris
A type family is a collection of types whose specific type is determined by one or more indices.
- How it is used
- Uses indices in dependent data types to distinguish related types and express constraints on function inputs and results.
- How deep it goes
- Works through indexed declarations and vector functions, including case splitting, but does not develop the underlying type theory.
- Examples
- Uses vehicles indexed by power source and vectors indexed by length, with append and zip as operations.
- What you can do after
- Build indexed data types and write functions whose types constrain valid inputs and results.
Read how Type-Driven Development with Idris explains type family →
Functional Design and Architecture: Examples in Haskell
A type family is a type-level function that computes a result type from one or more input types.
- How it is used
- Uses type-level selection to share one record structure across domain and database representations.
- How deep it goes
- Explains parameters, equations, aliases, and closed-family extensibility, but stops short of broader HKD techniques.
- Examples
- Uses meteor records, domain types, SQLite wrappers, Postgres wrappers, and a TypeSelector mapping table.
- What you can do after
- Apply it via a closed TypeSelector family to define shared records whose field types vary by representation.
Read how Functional Design and Architecture: Examples in Haskell explains type family →
Related concepts
- closed type familyincludes · A closed type family is a type family whose equations are fixed in its declaration and cannot be extended by separate instances.
- dependent typeequivalent to · A dependent type is a type whose definition or parameters can depend on values or expressions.
- type-level designkind of · A software design technique that encodes behavioral constraints and correctness conditions in types so the compiler can check them.
- higher-kinded data patternused by · The higher-kinded data pattern is a polymorphic data-structure pattern that abstracts field types so one declaration can represent multiple related type-specific variants.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

