Defined in The verb object Call signatures Return value A monadic type of the same kind Examples struct Error final std string what fn expected<int Error> ex 42 auto value ex | fn filter auto &&i return i > 42 Filter out values less than 42 auto return Error Less than 42 Return error if predicate fails REQUIRE value value 42 The resulting value is because the filter predicate returns for as it is not less than 42 true 42 42 struct Error final std string what fn expected<int Error> ex 12 auto value ex | fn filter auto &&i return i > 42 auto return Error Less than 42 REQUIRE value error what Less than 42 The error is set to because the predicate returns for since it s less than Less than 42 false 12 42 fn optional<int> op 42 auto value op | fn filter auto &&i return i > 42 Filter out values less than 42 REQUIRE value value 42 The resulting value is because the filter predicate returns for as it is not less than 42 true 42 42 fn optional<int> op 12 auto value op | fn filter auto &&i return i > 42 REQUIRE not value has_value The optional is empty because the predicate returns for since it s less than false 12 42 Filter the value of the monadic type using a predicate and an error handler When used on fn expected this operation takes both a predicate and an error handler However when used on fn optional this operation only takes a predicate Use through the fn filter nielbloid filter_t filter 1 Rejects a value the predicate refuses x | filter f constexpr auto operator auto &&pred auto &&on_err const > functor<filter_t decltype pred decltype on_err > 1 constexpr auto operator auto &&pred const > functor<filter_t decltype pred > 2 Filter the value of the monadic type using a predicate and an error handler return A functor that will filter the value of the monadic type pred auto && The predicate to filter the value takes the value by const reference and returns bool on_err auto && The error handler returning the error type consumes the value in the operand s value category Filter the value of the fn optional using a predicate and an error handler return A functor that will filter the value of the monadic type pred auto && The predicate to filter the value takes the value by const reference and returns bool