Skip to content
Halyard
Project, current section
Source code on Codeberg (opens in new tab)

Search

Menu

Changelog

0.0.1-alpha.2

2026151 changesView Release

Added

145 items
  • File inlining with inline "file" expression - Compose Keel programs from multiple files using inline as an expression that returns a record of exposed values: (4fdf44d) (f2c63c8) (05f3c4b)
  • inline "file" passing (vars) is an expression returning a record of all exposed values
  • Callee declares typed inputs/outputs with module (name : Type, ...) exposing (name : Type, ...)
  • Three forms for passing: explicit (x, y), catch-all (..), nothing () (or omit passing)
  • mut in exposing returns mutated values as record fields for explicit rebinding
  • Compile-time file resolution with circular dependency detection
  • Comprehensive error reporting: missing files, type mismatches, missing/extra variables, circular dependencies
  • Lenient parser mode - KeelParser::parse_file_lenient() returns best-effort AST alongside errors, enabling compilation of files where variables are introduced at compile time (e.g., module param bindings in imported files) (05f3c4b)
  • Pre-parse delimiter balancing - An O(n) token scan runs before the parser to detect mismatched, unclosed, or unexpected delimiters with precise, actionable error messages: (590c4b4)
  • SourceError hint tests - Added 4 tests for SourceError::hint() covering parentheses, brackets, braces, and no-match cases (b028d62)
  • ErrorHint for SourceError - Parse errors from chumsky (unmatched parens, brackets, braces) now provide actionable hints like "Check for a missing closing ).": (7dcfe79)
  • Doc comment panic test - Added test_doc_comment_does_not_panic to verify {-| doc comment -} compiles without panicking (7dcfe79)
  • Space-separated arguments for custom enum variants - Custom enum variants now support space-separated syntax for single arguments, matching the style of built-in types like Just 5. Both MyEnum::Variant(arg) and MyEnum::Variant arg are now valid: (37b2ed8)
  • Doc comments ({-| ... -}) - Elm-style doc comments for distinguishing documentation from implementation notes. Doc comments are lexed as Token::DocComment, parsed into Comment { is_doc: true } AST nodes, and preferred over regular comments in LSP hover output: (37b2ed8)
  • Comprehensive doc comment test suite (27 new tests) (37b2ed8)
  • Lexer tests (tests/lexer/lexer_doc_comments.rs, 17 tests): basic tokenization, content preservation (multiline, indented, special characters), distinction from block comments, interaction with surrounding tokens (fn, let, module), consecutive doc comments, edge cases (start/end of file, nested syntax)
  • Compiler integration tests (tests/compiler/doc_comments.rs, 10 tests): doc comments before functions, modules, let bindings, between declarations, multiple/multiline doc comments, mixed with line comments, standalone doc comments, verification that doc comments don't affect execution results
  • Native functions work with pipe operators and composition - Native stdlib functions (String.toUpper, List.length, Math.abs, etc.) now work correctly with pipe operators (|>), function composition (>>), and partial application: (e49ca6e)
  • Helpful error for missing parentheses in enum variants - When users write Ok a instead of Ok(a) in enum definitions, they now get a clear error instead of a confusing "unused type parameter" message: (02189d0)
  • Compiler support for typed record fields in lambda patterns - Type annotations on record fields in lambda patterns are now fully supported by the compiler: (925f6c2)
  • Standalone typed record lambdas work without requiring pipe context:
  • Type mismatch detection catches when annotated types conflict with actual values:
  • Mixed typed and untyped fields work correctly (untyped fields inferred from context):
  • Complex types like Int -> Int and List Int are supported in field annotations
  • Type annotations on record fields in lambda patterns - Record fields in lambda patterns can now have type annotations, just like tuple patterns: (925f6c2)
  • { name: String } - String is a type annotation
  • { name: n } - n is a pattern (variable binding)
  • Helpful error for tuple pattern type annotations - When users try to type-annotate a tuple pattern as a whole instead of its individual elements, they now get a helpful error message: (5faf3e8)
  • Tuple types as function arguments - Function signatures can now use tuple types directly as arguments. Previously, tuple types like (Int, String) were forbidden in function argument positions by the parser. This restriction has been removed: (cb2ce25)
  • Time Machine Debugger (behind time-machine feature flag) - A comprehensive debugging tool that captures state across all compilation and execution phases: (18ded36)
  • Unified Timeline: Tracks entries from lexer (tokens), parser (AST nodes), compiler (bytecode), and VM (execution) in chronological order
  • Bidirectional Navigation: Step forward/backward through the entire timeline or within a specific phase
  • Source Mapping: Full bidirectional mapping between source code byte offsets, tokens, AST nodes, and bytecode instructions
  • Cross-Phase Navigation: Jump from any token to its AST nodes, from AST to bytecode, from bytecode to VM executions (and back)
  • Integration Helpers: TimeMachineRecorder for easy recording during compilation
  • Enable with: cargo build --features time-machine
  • 100% error hint coverage - All 115 error variants across LexerError, ParserError, ScopeError, TypeError, CompileError, and VmError now have helpful hint() and note() implementations. Coverage improved from 62% to 100%: (8b4dc98)
  • ScopeError: Added hints for all 13 previously uncovered variants (UndeclaredVariable, UndeclaredFunction, UndeclaredModule, UndeclaredEnum, UndeclaredEnumVariant, UndeclaredTypeAlias, DuplicateVariable, DuplicateFunction, DuplicateFunctionSignature, DuplicateModule, DuplicateEnum, DuplicateEnumVariant, DuplicateTypeAlias)
  • LexerError: Added hints for InvalidInt, InvalidFloat, and UnknownToken
  • ParserError: Added hints for EnumInvalidEntry, ModuleInvalidExposedFunction, ModuleInvalidExposedType, ModuleInlineNoName, TypeDefinitionMissing, UndeclaredEnum, EnumVariantNotFound, NotAnEnum, and Unknown
  • VmError: Added hints for InvalidTuple, InvalidList, InvalidRecord, ConstantIndexOutOfBounds, UnsupportedOperation, UnexpectedInstruction, InvalidRecordSource, and MultipleTypeErrors
  • All new hints include both actionable suggestions and contextual notes
  • Added 93 new tests covering all error hint implementations
  • Parenthesized types for grouping in type annotations - Type annotations now support parentheses for grouping compound types as single arguments. This allows writing types like Result (Maybe Int) String where (Maybe Int) is grouped as the first type parameter: (ac2d3b2)
  • Type::Never (uninhabited type) - Added a new type representing unreachable code branches, similar to Rust's !, Haskell's Void, and TypeScript's never. This is used internally for pattern matching on sum types with unknown type parameters. (4f826da)
  • Module enum exports and imports - Enums can now be exported from modules and used correctly in importing code: (ced4afb)
  • Exported enums are now registered in the parent scope for type checking
  • Type::Custom is now resolved to Type::Enum when the custom type is a declared enum
  • Import handling correctly loads user-defined function closures instead of overwriting them
  • Both exposing (..) and specific exposing (Type, fn) syntax work correctly
  • Qualified enum syntax in patterns (Color::Green) - Enum patterns now support the same qualified syntax as expressions, providing consistency across the language: (ebcf001)
  • Rest pattern syntax (..) for record patterns - Keel now supports Rust-style rest patterns to ignore remaining fields when destructuring records: (2b134d3)
  • Helpful error for type Name = { record } syntax mistake - When users accidentally write type Person = { name: String, age: Int } instead of type alias Person = { ... }, they now get a clear error message instead of a confusing parse error: (ac2c034)
  • "Did you mean?" suggestions for module function typos - When you mistype a function name in a module call, Keel now suggests similar function names from that module: (8f8c99c)
  • Lambda type inference for native stdlib functions - Lambda parameters can now be inferred when passed to native stdlib higher-order functions like map, filter, foldl, etc. No explicit type annotation needed: (e49ca6e)
  • Added first_param_type: Option<Type> field to NativeFunction struct
  • Higher-order stdlib functions (map, filter, foldl, foldr, zipWith, any, all, find, partition, sortBy) now carry type information
  • Type variables (Type::Var) are compatible with any concrete type during type checking
  • Native function types (Type::Native) are compatible with function types for type validation
  • Lazy stdlib registration - User modules can now shadow stdlib module names (List, String, Math, IO) if they don't import the stdlib version. Stdlib modules are registered lazily when imported rather than upfront, allowing code like: (e0ec85a)
  • ErrorHint for CompileError and TypeError - Comprehensive hint and note implementations for compile-time and type-checking errors (896bc9d)
  • CompileError::ErrorHint provides hints for variable, module, enum, pattern matching, or-pattern, and type errors
  • TypeError::ErrorHint provides hints for type mismatches, inference issues, function errors, and compound types
  • KeelError now delegates hint() and note() to inner CompileError and TypeError types
  • Examples: "Declare it with let x = ...", "All branches must return the same type", "Keel is strongly typed"
  • IO module security controls - File system IO disabled by default for security (066e13c) (cb5746c)
  • KEEL_IO_DISABLED=0|false: Enable file/directory IO (disabled by default)
  • KEEL_IO_READ_ONLY=1|true: Allow only read operations, block writes/deletes
  • KEEL_IO_SANDBOX=/path: Restrict all operations to a specific directory
  • Controls can be combined (e.g., KEEL_IO_DISABLED=0 KEEL_IO_SANDBOX=/tmp)
  • New error variants: IoDisabled, IoReadOnly, IoSandboxViolation, IoInvalidSandbox
  • Console operations (print, println, etc.) always allowed regardless of settings
  • Pure path operations (joinPath, parentDir, etc.) always allowed
  • Environment/process operations (getEnv, setEnv, getArgs, exit) not affected
  • Comprehensive parser documentation - All parser modules now have Rust doc comments following best practices (931a959)
  • Module-level //! docs with architecture tables and examples
  • Function-level /// docs with argument descriptions and usage notes
  • Documented modules: parse_ast_node/*, parse_decl/*, parse_stmt/*, parse_expr/*
  • Topics covered: Pratt parsing, operator precedence, indentation handling, scope management, type parsing
  • Stdlib function documentation - All 132 stdlib functions now have structured documentation (ecf7330)
  • FunctionDoc struct with signature, description, example, notes, and see_also fields
  • to_markdown() method for LSP hover rendering
  • native_fn! macro for concise function registration with documentation
  • Documentation accessible at runtime via NativeFunction.doc field
  • Enables LSP hover info, completions, and signature help
  • Import error collection - Import-related errors are now properly collected during compilation (39d4d5d)
  • ModuleNotImported error when using a module without importing it (e.g., List.length without import List)
  • UndeclaredModule error when importing a non-existent module
  • UndeclaredModuleFunction error when calling a non-existent function in a module
  • All import errors include helpful hints (e.g., "Add import List at the top of your file")
  • Import system test coverage (18 new tests in tests/compiler/import_errors.rs) (39d4d5d)
  • Positive tests for imports working correctly (List, String, Math modules)
  • ModuleNotImported tests for using modules without import
  • UndeclaredModule tests for importing non-existent modules
  • UndeclaredModuleFunction tests for calling non-existent functions
  • Exposing tests for both positive cases and error cases
  • Error hint verification tests
  • Stdlib import tests (3 new tests in tests/stdlib/list.rs) (39d4d5d)
  • Multiple imports working together in one file
  • Exposing allows both qualified and unqualified access
  • Specific exposing allows qualified access for unexposed functions
  • Standard Library integrated into keel-core as the stdlib module (previously separate keel-stdlib crate) (1eb415d) (c90efa2) (496057e)
  • List module (34 functions): map, filter, foldl, foldr, length, head, tail, last, init, nth, concat, reverse, take, drop, zip, zipWith, any, all, find, partition, range, repeat, intersperse, sum, product, maximum, minimum, isEmpty, member, singleton, append, sort, sortBy, unique
  • String module (30 functions): length, isEmpty, contains, startsWith, endsWith, split, join, trim, trimLeft, trimRight, toUpper, toLower, replace, slice, charAt, toList, fromList, lines, unlines, words, unwords, padLeft, padRight, reverse, toInt, toFloat, fromInt, fromFloat, repeat, concat
  • Math module (37 functions): abs, min, max, clamp, floor, ceil, round, truncate, sqrt, pow, exp, log, log10, log2, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, pi, e, isNaN, isInfinite, isFinite, sign, negate, rem, gcd, lcm, toFloat, degrees, radians
  • IO module (31 functions): print, println, eprint, eprintln, readLine, readFile, writeFile, appendFile, fileExists, deleteFile, copyFile, renameFile, isDir, isFile, getFileSize, listDir, getCurrentDir, setCurrentDir, createDir, createDirAll, removeDir, removeDirAll, joinPath, parentDir, fileName, extension, absolutePath, getEnv, setEnv, getArgs, exit
  • Explicit import required: import List exposing (map, filter) or qualified access List.map
  • NativeFunction type for Rust-implemented functions callable from Keel code (1eb415d)
  • PartialNativeFunction type enabling currying for native functions (1eb415d)
  • Stdlib parser registration for module resolution (83fdef8)
  • 8 new end-to-end integration tests exercising complex language features (3efc053)
  • Recursive factorial function
  • Maybe type with pattern matching (safeDiv)
  • Closure capturing outer variables
  • Recursive list processing with cons pattern (x :: xs)
  • Pipe operator chains with multiple functions
  • Pattern matching with guards
  • Tuple destructuring in let bindings
  • Multiple closure captures
  • Comprehensive Rust doc comments for all public APIs (f8d4c0e)
  • Lexer module: KeelLexer, Token, IndentationState with usage examples
  • Parser module: KeelParser, ParserState, indentation handling
  • AST nodes: AstNode, Declaration, Statement, Binding, module content types
  • Compiler module: architecture overview and submodule descriptions
  • Utils module: utility function documentation
  • Parametric/generic enum types with type parameters (ebd1ebd)
  • Syntax: type Option a = None | Some(a) and type Either a b = Left(a) | Right(b)
  • Type parameters stored in AST (Declaration::Enum), Symbol (Symbol::Enum), and Type::Enum
  • Parser validates type parameters: errors for unused or undeclared parameters
  • Type inference for enum variant construction infers type arguments from constructor arguments
  • Scope storage for enum type parameters via EnumEntry struct
  • New error variants: EnumUnusedTypeParameter, EnumUndeclaredTypeParameter with helpful hints
  • Mark-sweep garbage collection for the VM heap (be47852)
  • HeapSlot enum wrapping heap objects with GC metadata (mark bit, free status)
  • heap_alloc() method for GC-aware allocation with automatic slot reuse
  • collect_garbage() method implementing mark-sweep algorithm
  • Root collection from registers, variables, and call stack frames
  • Transitive marking via worklist algorithm (handles nested structures and closure environments)
  • Free list for O(1) allocation from previously freed slots
  • Configurable GC_THRESHOLD constant (default: 1024 objects)
  • heap_get() and heap_get_mut() helper methods for accessing objects through HeapSlot
  • Comprehensive test suite (14 tests) covering GC behavior
  • SourceError struct for owned representation of parsing errors with span information (290545e)
  • List concatenation with ++ operator: [1, 2] ++ [3, 4] produces [1, 2, 3, 4] (c0fee09)
  • Dynamic register allocation: VM now pre-allocates exact number of registers needed based on bytecode.register_count set by compiler, replacing the hardcoded 64-register limit (2e4eeed)

Changed

6 items
  • Renamed Run* error variants to ImportFile* — All file import compiler error variants now use the ImportFile prefix instead of Run (e.g., RunFileNotFound → ImportFileNotFound, CircularRunDependency → CircularImportDependency). Renamed compile_run.rs → compile_import_file.rs. (f2c63c8)
  • Inlined test constants - Replaced 227 single-use const TEST_EXPR_*: &str declarations across 33 test files with string literals at the call site, reducing indirection and removing ~300 lines (3f493f2)
  • Zero compiler warnings - Suppressed deprecated next_heap_index warning and removed unnecessary .clone() on usize (b028d62)
  • Clippy cleanup - Applied 444 auto-fixable clippy suggestions (redundant closures, unnecessary conversions, collapsible if-lets, redundant field names, etc.), reducing warnings from 494 to 50 (b028d62)
  • Suppressed test naming warnings - Added #[allow(non_snake_case)] to all generated test functions in the keel_test! macro, eliminating hundreds of double-underscore naming warnings (b028d62)
  • Consolidated CHANGELOG headers - Merged duplicate ### Added/Changed/Fixed/Removed headers under `## [Unreleased]