To ensure reliability uses compiler mechanisms to reject malformed usage and preserve performance Constraints and Exhaustiveness Public concepts and clauses enforce correctness before instantiation Operations are protected by public applicability concepts such as and that evaluate to for invalid calls rather than triggering deep compiler errors This underpins the compile time exhaustiveness guarantees of and monadic operations established in Sections 4 and 12 C value properties The library respects C value mechanics Core operations are The algebra s own types and are structural when their elements are so a value of these types may be used as a template parameter is conditionally computed Value categories lvalue rvalue propagate strictly to callbacks avoiding copies Immovable and move only payloads are supported in place Reference bearing and are supported Lifetime management of non owning references remains with the caller compares element wise supporting equality and three way comparison For reference bearing comparison applies to the referents rather than the references themselves NOTE Note reference payloads Raw reference payloads are disallowed on the carriers and and as alternatives stores its payload in a union and C forbids a union member of reference type the algebra s own types refuse them so that every alternative is dispatched the same way whatever it holds is the deliberate exception the standard specifies it and polyfills it If you want to propagate references inside the other carriers wrap them in a e g pfn and fn The library is divided into layers Polyfill fn is the standards facing layer It provides and in their C 26 shape monadic member functions range support plus smaller utilities such as and all available to a C 20 compiler is the strict extension layer It introduces the algebra multidispatch graded errors the pipeline functors and the composition operators and Every type with a counterpart is a strict superset of it switching a valid program from to changes neither compilation nor behaviour libfn requires fn applicable_transform fn applicable_and_then false apply constexpr pack copack just choice constexpr noexcept pack<T& > optional<T&> pack pack<T& > expected just choice copack expected optional<T&> libfn pack expected<pack<T&> E> auto test_references > void int x 42 optional supports references directly fn optional<int &> opt x static_assert std same_as<decltype opt value int &> expected must wrap references inside a pack fn expected<fn pack<int &> Error> ex fn as_pack x static_assert std same_as<decltype ex value fn pack<int &> &> pfn std optional std expected optional<T&> std invoke_r std unreachable fn pack copack choice just & | fn pfn pfn fn