This repository was archived by the owner on Oct 12, 2026. It is now read-only.
Repository navigation
feat: unified type system - #5
Merged
Merged
Conversation
- Create lbd::types::Type with unified TypeKind enum - Support all type variants: NAMED, FUNCTION, APPLIED, QUALIFIED, CLOSURE, etc. - Implement factory methods: Type::named(), Type::function(), Type::applied() - Add type equality, hashing, and string representation - Implement runtime type matching with TypeTag optimization - Remove old duplicate type implementations
- Update frontend parser to use lbd::types::Type - Update symbol definitions and lambda expressions - Update NativeFunction to use unified type system - Update builtin modules (Core, IO, List) - Replace toString() calls with operator<< - Update Interpreter for type checking with unified types - Ensure proper type annotation handling throughout
- Remove include/lbd/type/Type.hpp (replaced by lbd::types::Type) - Remove include/lbd/type/TypeKind.hpp (merged into TypeKind enum) - Remove src/type/Type.cpp (implementation moved to lbd::types) Cleanup of old compile-time type system no longer needed.
Core type system tests: - type_system: Simple and higher-order function annotations - polymorphic_functions: Function composition patterns - curried_functions: Multi-argument curried functions - mutual_recursion: Mutual recursion (isEven/isOdd) - nested_applications: Deeply nested function applications - higher_order_generic: Generic higher-order functions - list_processing: List operations with map Edge cases and regression tests: - edge_cases_numbers: Zero, negative, large numbers - edge_cases_lists: Single/two element lists - deep_recursion: Recursive sum computation - regression_lazy_eval: Lazy evaluation verification - complex_typing: Multi-level function composition - variadic_functions: Map and foldRight operations - any_type_annotations: Any type handling - list_reduction: FoldRight aggregation All tests passing: 25/25 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Lambda-discipline maintains two separate type systems (compile-time and runtime) causing code duplication and type information loss at the compilation boundary.
Solution
Consolidated into a single
lbd::types::Typesystem serving both compile-time and runtime needs with proper lazy evaluation and variadic function support.Changes
lbd::types::Typewith unifiedTypeKindenumlbd::type::Typeandlbd::runtime::type::TypeType::named(),Type::function(),Type::applied()hardCheckflag for lazy evaluation controlisVariadicflag for variadic function trackingm_prefix convention for all private membersResults
Test Coverage