Re: Maybe macros Wolfgang Corcoran-Mathe 28 Jun 2020 17:26 UTC

On 2020-06-27 22:46 +0200, Marc Nieper-Wißkirchen wrote:
> I have to think of how much `-and' and `-or' without any argument make
> sense logically. In any case, the payload of the Just/Right or the
> Left would have nothing to do with truth or the falsehood of the
> `-and' or `-or' form. So wrapping `#t' or `#f' is definitely not "the
> right thing".

This seems like the stickiest point to get right with these forms.
I'd tentatively suggest the following.  If no expressions are passed
to the maybe/either -and/-or forms,

* maybe-or returns Nothing

* maybe-and returns a Just whose payload is a single unspecified value

* either-or returns a Left whose payload is a single unspecified value

* either-and returns a Right whose payload is a single unspecified value

For the last three forms: I find the container-of-no-values solution
elegant, but I think single-valued containers are much easier to
deal with (as John also notes).  The unit of the operations are,
respectively, any Just/Left/Right, so it makes sense to me that we
leave the payload unspecified.

Wolfgang Corcoran-Mathe  <>

"Earth is the cradle of the mind, but one cannot live in a
cradle forever." --Konstantin Tsiolkovsky