commits
* feat(builder-macro): conditional Has<T> impl for builder types
- Macro now generates impl Has<T> for builder only when the corresponding field is Present
- Added integration test to verify Has<T> is only implemented when field is present
- Refactored builder macro to use UpperCamelCase marker types
- All builder macro tests pass and code is formatted
Unlocks type-driven context provision and safer builder usage. Future: extend to more traits and ergonomic context composition. ��
* refactor(builder-macro): move Absent/Present marker types to builder_types crate
- Created builder_types crate to host Absent and Present marker types
- Macro now generates code referencing builder_types::Absent and builder_types::Present
- Updated integration and test code to import marker types from builder_types
- Ensures proc-macro crate does not export non-macro items, following Rust best practices
This enables clean separation of marker types and macro logic, and future extensibility for builder state markers. 🧩
* refactor: migrate Put trait to type-parameter output form 🦀
- Refactored all Put trait usages to use type parameters (Put<T, U>) instead of associated type.
- Updated builder and lens macros to generate new Put impls.
- Updated all manual Put impls and trait bounds in core and tests.
- Fixed logic in manual Put impls to properly update struct fields.
- Ensured all tests are green and code is formatted.
- This unlocks more flexible type-changing builder and lens operations, and simplifies trait bounds throughout the system.
* refactor(abilities_macro): remove boxes and generalize ability construction 🧩
- Updated macro to return impl Ability instead of Box for ability construction functions.
- Generalized method signatures to allow any Ability type, not just boxed trait objects.
- Updated integration tests to match new API and type signatures.
- Improves ergonomics and flexibility for effectful code and ability usage.
Future work:
- Extend macro to support more context shapes and derive HasPut for structs.
- Refactor Pair usage in effect APIs for full genericity.
* feat(core): add provide_has for ergonomic partial context provision 🧩
- Added Fx::provide_has, allowing partial context provision using HasPut/Put trait, supporting both tuples and structs.
- Added tests for provide_has with struct context (i32 and String fields).
- Improves ergonomics for effectful code with custom context shapes.
Future work:
- Extend HasPut/Put derive macros for easier struct support.
- Refactor provide_left and related APIs to use HasPut for full genericity.
* refactor(core): rename provide_has to update_context and improve context mutation API 🧩
- Renamed Fx::provide_has to Fx::update_context for clarity and ergonomics.
- Updated all tests and usages to use update_context.
- Added and improved tests for struct-based context mutation and handler replacement.
- This change clarifies the API semantics, making context adaptation and mutation explicit and more general.
Future work:
- Extend HasPut/Put derive macros for easier struct support.
- Refactor related APIs for full genericity and ergonomic context adaptation.
BREAKING CHANGE: The Has trait now requires fn get(self) -> T, replacing the previous reference-based API. All manual and macro-generated Has impls, as well as all test and usage code, have been updated to match. This enables more ergonomic value extraction and aligns with strict TDD and incremental refactoring rules. Lens API and macro crates were also updated for compatibility. Future work: consider ergonomic helpers for reference extraction if needed, and audit downstream crates for usage patterns.
* ✨ feat(core): add lift_map combinator for HasPut effect sequencing
This change introduces the `lift_map` method to the `Fx` type, enabling effect sequencing over multiple `HasPut` requirements. The new combinator allows chaining of effects that require different state fragments, improving composability for advanced effectful programming patterns.
A comprehensive test, `lift_map_composes_effects_with_hasput`, is added to verify correct sequencing and context usage. This test demonstrates how `lift_map` can be used to compose two effects with distinct `HasPut` requirements in a single state context.
Future work may include further generalization of effect composition utilities and additional tests for edge cases and ergonomics.
* refactor(tests): deduplicate Has/Put impls and structs in fx_test.rs 🎯
- Move common structs (A, B, S) and their Has/Put trait implementations to the top of the test file.
- Remove repeated struct and trait definitions from individual tests, updating them to use the shared types.
- Update tests to use B(i32) instead of B(&str), and adjust logic accordingly.
- Suppress dead_code warning for unused test struct fields where needed.
This refactor reduces code duplication, improves maintainability, and keeps all tests green. Future test additions can now use the shared types directly.
* feat(core): add lift_req combinator for staged context provision and test 🎯
- Add Abilities::lift_req for staged context/effect composition using HasPut
- Add test for lift_req (ability + state) in ability_test.rs
- Organize imports in ability_test.rs (no inline imports)
- Minor formatting cleanup in fx_test.rs
This change enables staged effect composition with HasPut, improving ergonomics for advanced effectful programming patterns. The new test demonstrates correct usage and context provision. Future work: extend staged context combinators and add more effect composition tests.
Manually threads state and accumulator in a single Fx::pending block and checks commutativity by swapping the pair. Ensures the test compiles and passes.
- Removes the old proc macro implementation for forall_fields
- Keeps only the #[derive(ForallFields)] macro with enum-based ergonomic API
- Ensures all tests and documentation use the new approach exclusively
- Updates the ForallFields derive macro to generate a forall_fields method using the enum-based approach
- Updates all tests to use the new method name
- Removes all references to the old API for clarity and consistency
- Adds a derive macro that generates a method forall_fields for any struct with named fields
- Updates tests to use the derive macro for law-checking and property-based assertions on all fields
- Removes all usage of the old macro_rules! and procedural macro entrypoint
- Enables ergonomic, type-agnostic field traversal for effectful and law-based testing
- Add tests in quantified_laws.rs for State<T> using concrete types (i32, String)
- Ensures quantified effect laws are enforced and verified for real-world types
- All tests pass and code is warning-free
- Implement initial macro_rules! forall_fields! for structs with fields a, b, c
- Add integration tests demonstrating usage and law checking
- Remove doc-tests and proc-macro setup; keep examples as tests only
- All tests pass, no warnings
Introduce Forall trait for universally quantified effectful computations in fx. Add initial test to verify trait implementation and object safety. Update mod.rs to include and test Forall. All workspace tests pass.
Introduces core/quant.rs with a Quantify trait and a quantify combinator on Fx. Adds a test for quantified effects in quant_test.rs. All tests pass.
Removes the legacy from_has_put method from Lens. All field lens construction now uses Lens::from(()) via the From<()> impl, including macro-generated code and tests. This unifies and simplifies the API, ensuring a single, type-driven way to construct field lenses. All tests pass.
- Implements From<()> for Lens, enabling ergonomic construction for any context supporting Has and Put
- Adds a test to verify Lens::from(()) works for such types
- All tests pass
This improves type-driven ergonomics for lens construction in effectful code.
- Relocate all *_test.rs and test.rs files from src/core/ to src/core/tests/
- Remove test module inclusions from mod.rs and lens.rs
- Ensure all tests are still discoverable and passing
This improves code organization and test hygiene.
- Move all *_test.rs and test.rs files from src/core/ to src/core/tests/
- Remove test module inclusions from mod.rs and lens.rs
- Update project to use a dedicated tests/ directory for unit tests
- All tests pass after the move
This improves code organization and test discoverability.
- Add Lens::from_has_put constructor for any Outer: Has<Inner> + Put<Inner>
- Add public get/set methods to Lens for ergonomic access
- Add and enable a test module for Lens::from_has_put
- Ensure all tests pass and integration is seamless
This enables ergonomic, type-driven lens construction for any context supporting Has and Put, and is fully covered by tests.
Introduce Put<T> for functional updates to context types. Includes blanket impl for leaf types and tests for both identity and struct field update cases.
Migrate all effect context projection traits, derive macros, and usages to Has<T> and get(). Update all affected crates and tests.
This reverts commit e79ba6ca55bf58d866cf607381e21e7848a4a552.
* do! macro for "direct style"
* Update crates/do_traits/src/lib.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* error message
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Make flat_map generic over product
* product on provide_left
This reverts commit 4a9fd117edf20192edfd24904cd083956e4d1554.
* feat(builder-macro): conditional Has<T> impl for builder types
- Macro now generates impl Has<T> for builder only when the corresponding field is Present
- Added integration test to verify Has<T> is only implemented when field is present
- Refactored builder macro to use UpperCamelCase marker types
- All builder macro tests pass and code is formatted
Unlocks type-driven context provision and safer builder usage. Future: extend to more traits and ergonomic context composition. ��
* refactor(builder-macro): move Absent/Present marker types to builder_types crate
- Created builder_types crate to host Absent and Present marker types
- Macro now generates code referencing builder_types::Absent and builder_types::Present
- Updated integration and test code to import marker types from builder_types
- Ensures proc-macro crate does not export non-macro items, following Rust best practices
This enables clean separation of marker types and macro logic, and future extensibility for builder state markers. 🧩
* refactor: migrate Put trait to type-parameter output form 🦀
- Refactored all Put trait usages to use type parameters (Put<T, U>) instead of associated type.
- Updated builder and lens macros to generate new Put impls.
- Updated all manual Put impls and trait bounds in core and tests.
- Fixed logic in manual Put impls to properly update struct fields.
- Ensured all tests are green and code is formatted.
- This unlocks more flexible type-changing builder and lens operations, and simplifies trait bounds throughout the system.
* refactor(abilities_macro): remove boxes and generalize ability construction 🧩
- Updated macro to return impl Ability instead of Box for ability construction functions.
- Generalized method signatures to allow any Ability type, not just boxed trait objects.
- Updated integration tests to match new API and type signatures.
- Improves ergonomics and flexibility for effectful code and ability usage.
Future work:
- Extend macro to support more context shapes and derive HasPut for structs.
- Refactor Pair usage in effect APIs for full genericity.
* feat(core): add provide_has for ergonomic partial context provision 🧩
- Added Fx::provide_has, allowing partial context provision using HasPut/Put trait, supporting both tuples and structs.
- Added tests for provide_has with struct context (i32 and String fields).
- Improves ergonomics for effectful code with custom context shapes.
Future work:
- Extend HasPut/Put derive macros for easier struct support.
- Refactor provide_left and related APIs to use HasPut for full genericity.
* refactor(core): rename provide_has to update_context and improve context mutation API 🧩
- Renamed Fx::provide_has to Fx::update_context for clarity and ergonomics.
- Updated all tests and usages to use update_context.
- Added and improved tests for struct-based context mutation and handler replacement.
- This change clarifies the API semantics, making context adaptation and mutation explicit and more general.
Future work:
- Extend HasPut/Put derive macros for easier struct support.
- Refactor related APIs for full genericity and ergonomic context adaptation.
BREAKING CHANGE: The Has trait now requires fn get(self) -> T, replacing the previous reference-based API. All manual and macro-generated Has impls, as well as all test and usage code, have been updated to match. This enables more ergonomic value extraction and aligns with strict TDD and incremental refactoring rules. Lens API and macro crates were also updated for compatibility. Future work: consider ergonomic helpers for reference extraction if needed, and audit downstream crates for usage patterns.
* ✨ feat(core): add lift_map combinator for HasPut effect sequencing
This change introduces the `lift_map` method to the `Fx` type, enabling effect sequencing over multiple `HasPut` requirements. The new combinator allows chaining of effects that require different state fragments, improving composability for advanced effectful programming patterns.
A comprehensive test, `lift_map_composes_effects_with_hasput`, is added to verify correct sequencing and context usage. This test demonstrates how `lift_map` can be used to compose two effects with distinct `HasPut` requirements in a single state context.
Future work may include further generalization of effect composition utilities and additional tests for edge cases and ergonomics.
* refactor(tests): deduplicate Has/Put impls and structs in fx_test.rs 🎯
- Move common structs (A, B, S) and their Has/Put trait implementations to the top of the test file.
- Remove repeated struct and trait definitions from individual tests, updating them to use the shared types.
- Update tests to use B(i32) instead of B(&str), and adjust logic accordingly.
- Suppress dead_code warning for unused test struct fields where needed.
This refactor reduces code duplication, improves maintainability, and keeps all tests green. Future test additions can now use the shared types directly.
* feat(core): add lift_req combinator for staged context provision and test 🎯
- Add Abilities::lift_req for staged context/effect composition using HasPut
- Add test for lift_req (ability + state) in ability_test.rs
- Organize imports in ability_test.rs (no inline imports)
- Minor formatting cleanup in fx_test.rs
This change enables staged effect composition with HasPut, improving ergonomics for advanced effectful programming patterns. The new test demonstrates correct usage and context provision. Future work: extend staged context combinators and add more effect composition tests.
- Adds a derive macro that generates a method forall_fields for any struct with named fields
- Updates tests to use the derive macro for law-checking and property-based assertions on all fields
- Removes all usage of the old macro_rules! and procedural macro entrypoint
- Enables ergonomic, type-agnostic field traversal for effectful and law-based testing
- Add Lens::from_has_put constructor for any Outer: Has<Inner> + Put<Inner>
- Add public get/set methods to Lens for ergonomic access
- Add and enable a test module for Lens::from_has_put
- Ensure all tests pass and integration is seamless
This enables ergonomic, type-driven lens construction for any context supporting Has and Put, and is fully covered by tests.