A type family is a type that varies with a term.
Intuition: it’s like an “indexed collection of types.”
If , then a type family over is . So for each , you get a type
NOTE
It’s natural to choose as (
Nat), but it can also be other types.
Example: family of finite sets
The family of finite sets , where gives a type that describes a set with exactly elements. (each element of this set has type )
- has elements where
Example 2
- The constant type family over with value is a family that ignores its “index”. That is: the type family always gives a fixed type . So every fiber is the same type.
- The constant function (input , output ) (see λ-calculus)