Type compatibility
Type compatibility is the relationship in which values of one type can be used where another type is expected under applicable language rules.
Building User-Friendly DSLs
A relation between types specifying whether values of one type can be used where values of another type are expected.
- How it is used
- Uses type compatibility to validate expressions, constrain attribute values, and select type-specific rendering.
- How deep it goes
- Implements equality-based matching and contrasts it with assignability, inheritance, and coercion without implementing those broader relations.
- Examples
- Demonstrates compatibility with amount, date range, percentage, untyped values, binary subtraction, attribute assignments, and display markers.
- What you can do after
- Build it from scratch by representing types as objects, comparing stable IDs, and propagating checks into constraints and projections.
Read how Building User-Friendly DSLs explains type compatibility →
Clojure: The Essential Reference
Type compatibility is the property that two values belong to categories that an operation can compare according to its compatibility rules.
- How it is used
- Compares Clojure values with diff while preserving compatible collection structure.
- How deep it goes
- Explains collection predicates, scalar equality, nested outputs, exceptions, and deep-recursion limits.
- Examples
- Uses vectors, lists, maps, sets, arrays, sorted maps, and deeply nested maps as comparison cases.
- What you can do after
- Diagnose compatible and incompatible comparisons by interpreting diff's unique and common result positions.
Read how Clojure: The Essential Reference explains type compatibility →
Functional Programming in JavaScript
The property that one function’s output type matches another function’s accepted input type.
- How it is used
- Connects stages in functional pipelines by matching returned values with receiving function inputs.
- How deep it goes
- Defines output-input matching, explains duck typing in JavaScript, and stops short of covering static type systems.
- Examples
- Uses trim, normalize, and isValid to process a Social Security number through compatible function stages.
- What you can do after
- Apply it via function signatures to design pipelines whose stages accept one another’s outputs.
Read how Functional Programming in JavaScript explains type compatibility →
Related concepts
- subtypingmeasured by · Subtyping is a type-system relationship in which values of a more specific type can be used wherever a compatible, more general type is expected.
- assignment compatibilityuses · Assignment compatibility is a type-system relation determining whether a value or expression of one type can be assigned to an object of another type.
- type equalityequivalent to · A type equality is a constraint asserting that two type expressions must denote the same type.
- arityequivalent to · Arity is the number of arguments or operands accepted by a function, method, operator, or other operation.
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.


