Commit Graph

3 Commits

Author SHA1 Message Date
62be78ff99 feat: implement better error messages with 'Did you mean?' suggestions
Add Levenshtein distance-based similarity matching for undefined
variables, unknown types, unknown effects, and unknown traits.
When a name is not found, the error now suggests similar names
within edit distance 2.

Changes:
- Add levenshtein_distance() function to diagnostics module
- Add find_similar_names() and format_did_you_mean() helpers
- Update typechecker to suggest similar names for:
  - Undefined variables
  - Unknown types
  - Unknown effects
  - Unknown traits
- Add 17 new tests for similarity matching

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:39:26 -05:00
15a820a467 fix: make all example programs work correctly
- 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>
2026-02-13 09:05:06 -05:00
d37f0fb096 Add Elm-style error diagnostics
Implement beautiful, informative error messages inspired by Elm:
- Rich diagnostic rendering with source code snippets
- Colored output with proper underlines showing error locations
- Categorized error titles (Type Mismatch, Unknown Name, etc.)
- Contextual hints and suggestions for common errors
- Support for type errors, runtime errors, and parse errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 04:01:49 -05:00