Add full support for user-defined generic types and functions:
- Add type_params field to TypeChecker to track type parameters in scope
- Update resolve_type() to resolve type parameters to their bound variables
- Update function_type() to bind type parameters and return polymorphic TypeScheme
- Update type declaration handling for generic ADTs (e.g., Pair<A, B>)
Generic functions and types now work:
fn identity<T>(x: T): T = x
type Pair<A, B> = | MkPair(A, B)
fn first<A, B>(p: Pair<A, B>): A = ...
Add examples/generics.lux demonstrating:
- Generic identity function
- Generic Pair type with first/second accessors
- Generic mapOption function
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add string concatenation support to + operator in typechecker
- Register ADT constructors in both type environment and interpreter
- Bind handlers as values so they can be referenced in run...with
- Fix effect checking to use subset instead of exact match
- Add built-in effects (Console, Fail, State) to run block contexts
- Suppress dead code warnings in diagnostics, modules, parser
Update all example programs with:
- Expected output documented in comments
- Proper run...with statements to execute code
Add new example programs:
- behavioral.lux: pure, idempotent, deterministic, commutative functions
- pipelines.lux: pipe operator demonstrations
- statemachine.lux: ADT-based state machines
- tailcall.lux: tail call optimization examples
- traits.lux: type classes and pattern matching
Add documentation:
- docs/IMPLEMENTATION_PLAN.md: feature roadmap and status
- docs/PERFORMANCE_AND_TRADEOFFS.md: performance analysis
Add benchmarks for performance testing.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>