Skip to content

Rename <fn/monadic.hpp> to <fn/traits.hpp>, guard `monadic_invoca… - #444

Merged
Bronek merged 3 commits into
mainfrom
bronek/traits_header
Sep 29, 2026
Merged

Bronek merged 3 commits into
mainfrom
bronek/traits_header

Conversation

@Bronek

@Bronek Bronek commented Sep 28, 2026

Copy link
Copy Markdown
Member

Rename <fn/monadic.hpp> to <fn/traits.hpp> and move some_in_place_type there.

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 the apply traits 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

@Bronek
Bronek added this pull request to stack #445 September 28, 2026 20:14
@augmentcode

augmentcode Bot commented Sep 28, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary:

  • Renames the public <fn/monadic.hpp> header to <fn/traits.hpp>.
  • Removes the old header and its detail counterpart rather than providing a compatibility shim.
  • Moves some_in_place_type into the new traits header while preserving its availability through <fn/copack.hpp>.
  • Hoists monadic trait implementation into fn/detail/traits.hpp.
  • Adds a completeness check before evaluating a functor in monadic_invocable.
  • Reuses that check for complete pack and copack operands in apply traits.
  • Updates dependent headers, installation header lists, and API-reference include badges.
  • Adds traits-focused unit coverage and positive controls for the completeness helper.
Technical notes: The API change is explicitly breaking: clients must replace direct old-header includes, and forward-declared functor queries are intended to fail rather than cache an order-dependent concept result.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread include/fn/detail/traits.hpp Outdated

template <typename Functor, typename V, typename... Args>
concept _monadic_invocable
= _complete_class<Functor>() && _some_monadic_type<V> && ::std::invocable<typename Functor::apply, V, Args...>;

@augmentcode augmentcode Bot Sep 28, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, fixed.

Comment thread CHANGELOG.md
@Bronek
Bronek force-pushed the bronek/traits_header branch from 8b90ec3 to 9e087c2 Compare September 28, 2026 20:38
@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Bronek
Bronek force-pushed the bronek/traits_header branch 4 times, most recently from 08ca67f to 9ca319e Compare September 29, 2026 20:46
@Bronek
Bronek removed this pull request from stack #445 September 29, 2026 21:20
@Bronek
Bronek added this pull request to stack #446 September 29, 2026 21:21
@Bronek
Bronek removed this pull request from stack #446 September 29, 2026 21:24
@Bronek
Bronek force-pushed the bronek/incomplete_apply_operand branch from 6ed28f4 to b661fa8 Compare September 29, 2026 21:30
@Bronek
Bronek force-pushed the bronek/traits_header branch 2 times, most recently from 18185f0 to 57a6e1e Compare September 29, 2026 21:32
@Bronek
Bronek force-pushed the bronek/incomplete_apply_operand branch 2 times, most recently from 6d2c3d0 to cd7c718 Compare September 29, 2026 21:34
@Bronek
Bronek force-pushed the bronek/traits_header branch 2 times, most recently from 50c0ccd to b9b6592 Compare September 29, 2026 21:38
@Bronek
Bronek force-pushed the bronek/incomplete_apply_operand branch from cd7c718 to 8f7f465 Compare September 29, 2026 21:38
@Bronek
Bronek changed the base branch from bronek/incomplete_apply_operand to main September 29, 2026 21:39
…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
@Bronek
Bronek force-pushed the bronek/traits_header branch from b9b6592 to 56e2d2f Compare September 29, 2026 21:43
@Bronek
Bronek merged commit b617188 into main Sep 29, 2026
55 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant