Rename <fn/monadic.hpp> to <fn/traits.hpp>, guard `monadic_invoca… - #444
Conversation
🤖 Augment PR SummarySummary:
🤖 Was this summary useful? React with 👍 or 👎 |
|
|
||
| template <typename Functor, typename V, typename... Args> | ||
| concept _monadic_invocable | ||
| = _complete_class<Functor>() && _some_monadic_type<V> && ::std::invocable<typename Functor::apply, V, Args...>; |
There was a problem hiding this comment.
include/fn/detail/traits.hpp:39: A complete Functor can still have a forward-declared nested apply; this evaluates std::invocable on an incomplete callable, whose result can change after apply is defined (and violates its incomplete-type precondition). Thus the new guard does not provide the stated order-independent monadic_invocable result for user-defined verbs.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
8b90ec3 to
9e087c2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
08ca67f to
9ca319e
Compare
6ed28f4 to
b661fa8
Compare
18185f0 to
57a6e1e
Compare
6d2c3d0 to
cd7c718
Compare
50c0ccd to
b9b6592
Compare
cd7c718 to
8f7f465
Compare
…ble` Rename the public traits header and fold detail/monadic.hpp into detail/traits.hpp. Move some_in_place_type alongside the other traits. Require complete functor types in monadic_invocable to prevent concept satisfaction from changing after a definition. Share the completeness check with the apply traits. Direct includes of monadic.hpp must change to traits.hpp. Assisted-by: Claude:claude-opus-5-5 Assisted-by: Codex:gpt-6-astra
Only `static_assert` exercised it, so coverage never saw its body. Assisted-by: Claude:claude-opus-5-5
A complete verb may still only declare its nested `apply`, as libfn's own verbs do before defining it out of line. Asked in between, `std::invocable` saw an incomplete type: libstdc++ rejects that from inside <type_traits>, while libc++ answered `false` and kept it after `apply` was defined. The guard now checks `apply` too, with the same diagnostic. Assisted-by: Claude:claude-opus-5-5
b9b6592 to
56e2d2f
Compare
|



Rename
<fn/monadic.hpp>to<fn/traits.hpp>and movesome_in_place_typethere.Breaking: replace direct includes of
<fn/monadic.hpp>; there is no compatibility header.Require complete functor types in
monadic_invocable, including user-defined classes and unions. This prevents concept satisfaction from changing after the definition. Share the completeness check with theapplytraits and add positive controls for the guard; the suite cannot yet test compilation failures.Assisted-by: Claude:claude-opus-5-5
Assisted-by: Codex:gpt-6-astra