Planned: ADTs & Pattern Matching
Relevant source files
The following files were used as context for generating this wiki page:
Algebraic Data Types (ADTs) and Pattern Matching are core aspirational features of the Jazz language, designed to provide a robust functional programming experience similar to Haskell and Elixir. While the project currently supports strong static typing and type inference for a core expression subset, ADTs and Pattern Matching are slated for end-to-end implementation across the compiler and runtime.
These features are intended to work within Jazz's broader goals of providing "easy to understand syntax" while maintaining functional purity and performance via an LLVM backend. Current development efforts for these features are strictly restricted to the jazz-next/ directory.
Sources: README.md:21-28, README.md:9-19, AGENTS.md:5-12
Feature Status and Scope
ADTs and Pattern Matching are categorized as "Planned / Aspirational" features. This means they are not yet fully implemented through the parse, analyze, codegen, and runtime phases. The current implementation baseline is documented in docs/jazz-language-state.md and verified against a feature-status matrix.
| Feature Component | Implementation Status | Target Workspace |
|---|---|---|
| ADTs | Planned (End-to-end behavior) | jazz-next/ |
| Pattern Matching | Planned (End-to-end behavior) | jazz-next/ |
| Core Type Inference | Implemented | jazz-next/ |
| Strong Static Typing | Implemented | jazz-next/ |
Sources: README.md:21-23, README.md:29-31, jazz-next/README.md:3-5, scripts/check-docs.sh:30-33
Integration with Compiler Pipeline
The implementation of ADTs and Pattern Matching will follow the standard jazz-next compiler architecture. This involves several distinct stages from surface parsing to the final LLVM backend.
Compiler Flow for New Features
The diagram below illustrates how ADTs and Pattern Matching will be processed through the active jazz-next compiler slices.
The compiler pipeline ensures that new constructs like ADTs are lowered from surface syntax to a core AST suitable for scope-aware analysis and type inference.
Sources: jazz-next/README.md:11-23, README.md:25
Design Objectives
The design for ADTs and Pattern Matching in Jazz aims to balance Haskell-inspired functional power with readability.
Key Objectives
- End-to-End Behavior: Unlike "parse-only" stubs, these features are intended to have full runtime representation and compiler support.
- Static Verification: Pattern matching will integrate with the existing strong static typing system to ensure exhaustive checks (though full effect typing is still a future goal).
- Performance: The LLVM backend is the primary performance target for these data structures.
- Readability: Maintaining a syntax that is approachable for beginners, moving away from complex category theory terminology toward standard typeclass approaches (e.g.,
Collection,Orderable).
Sources: README.md:8-12, README.md:21-26, README.md:120-125
Governance and Implementation Policy
Implementation of these features is governed by strict project policies regarding "Spec Authority." Any semantic language changes regarding how ADTs or Pattern Matching behave require a formal Decision Record or RFC before implementation can begin.
Execution Guardrails
- Read-Only Directories: No work on ADTs or Pattern Matching may occur in
jazz-hs/orjazz2/. - Active Target: All new behavior, APIs, and codegen changes must land in
jazz-next/. - Documentation Sync: Non-semantic changes are only permitted if documentation and tests are updated in the same commit.
Sources: AGENTS.md:5-13, README.md:34-40, scripts/check-spec-authority.sh:28-35
Conclusion
ADTs and Pattern Matching represent a significant expansion of the Jazz language's capabilities. By moving these features from the "Planned" stage into the jazz-next/ implementation path, the project aims to fulfill its promise of a Haskell-inspired functional language with a beginner-friendly type system and high-performance execution.
Sources: README.md:8-12, README.md:21-23, AGENTS.md:11-13