C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Lack of monadic operations in 'std::expected'

From: Jarrad Waterloo <descender76_at_[hidden]>
Date: Tue, 18 Oct 2022 15:07:09 -0400
It is very far along, though completed, couldn't be integrated before the
cutoff date.

https://github.com/cplusplus/papers/issues/1161

Similar to function_ref there is interest in national body comments to ask
for function_ref to get in somehow even though it too was punted to C++26.
I am unfamiliar with the national body comments process but it would be
wonderful if the following could be considered.

function_ref: The changes over the past year were mainly dangling fixes and
primary use case enhancements. Otherwise the core contents of the paper was
ready over a year ago.
monadic functions for expected: are purely the addition of a few functions
mdarray is similarly complete and had been tracking last minute changes to
mdspan, container and last minute deletions
#embed is going into C23 though it was originally proposed for C++; I
couldn't think of a greater testament to the ongoing cooperation to the C
and C++ communities if there was a simultaneous release.
lazy is so anemic that it is practically a tag class

peanut butter is to jelly as
move_only_function is to function_ref, as
mdspan is to mdarray, as
generator is to lazy

While I wouldn't want any of the former to be delayed, I would be elated if
exceptions were made for the laters.

There is also, seemingly, a backlog on somewhat completed language features.

Needless to say if none of these somehow make it into C++23, C++26 is going
to be a good release before we even get to the good stuff. However, I would
rather see C++23 made as great as it could reasonably be in remembrance of
any fallen comrades during this COVID release and a testament to our
tenacious spirit to persevere despite the loss of the annual meetings and
conferences.





On Tue, Oct 18, 2022 at 2:32 PM Oleksandr Koval via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> https://wg21.link/P2505
>
> On Tue, Oct 18, 2022 at 9:27 PM Shiroki Satsuki via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> 'std::expected' adds a nice way of handling errors without using the
>> exception system and will be included in C++ 23. 'std::optional' is
>> going to have monadic operations in this version too.
>>
>> However, the current 'std::expected' proposal
>> (https://wg21.link/p0323r10) makes no mention of monadic operations,
>> neither 'transform' (aka 'map') nor 'and_then' (aka 'bind' or
>> 'flatMap'). A generic associated types 'rebind<U>' is included, though.
>>
>> It would be a pity if functional programming lovers must wait until C++
>> 26 for a complete 'Either' monad.
>>
>>
>>
>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>
>
> --
> Regards,
> Oleksandr Koval.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2022-10-18 19:07:21