Product type
A product type is a composite type whose values combine one value from each of several component types, such as a tuple or record.
Functional Design and Architecture: Examples in Haskell
A product type combines multiple component values into one composite value, such as a tuple or record.
- How it is used
- Uses product types to construct functional domain models and composite data structures.
- How deep it goes
- Defines tuples and records as product types and places them within algebraic data types, without detailing implementation semantics.
- Examples
- Demonstrates product types through PersonName tuples and Person records containing names and ages.
- What you can do after
- Build it from scratch by combining related values into tuple- or record-shaped domain types.
Read how Functional Design and Architecture: Examples in Haskell explains product type →
Write Powerful Rust Macros
A product type is a composite type whose possible values are combinations of values from all its component fields.
- How it is used
- Frames struct-like values as algebraic data types while motivating controlled alternatives for error handling.
- How deep it goes
- Defines state multiplication with a worked example, then contrasts product types with sum types without implementing product types.
- Examples
- Uses a struct containing a u8 and boolean, contrasting values such as 120,true and 119,true.
- What you can do after
- Evaluate how a struct’s field combinations expand its state space and why validation may require conditionals.
Related concepts
- algebraic data typekind of · An algebraic data type is a composite type whose values are formed from product structures, finite alternatives, or both through type constructors.
- union typecontrasts with · A union type is a type whose values can be any one of several specified alternative types or variants.
- anonymous recordincludes · An anonymous record is an F# record value with named fields whose record type is inferred without an explicit named type declaration.
- Cartesian productuses · A Cartesian product is the set of all ordered tuples formed by selecting one element from each of multiple sets or sequences.
- recordincludes · A record is a programming-language construct for declaring a data-oriented type, typically with generated members and equality based on its data.
- recordincludes · A record is a structured data item comprising related values associated with fields or positions, representing one entry or observation in a collection.
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.

