Maybe macros
John Cowan
(26 Jun 2020 17:16 UTC)
|
Re: Maybe macros
Marc Nieper-Wißkirchen
(26 Jun 2020 17:43 UTC)
|
Re: Maybe macros
John Cowan
(26 Jun 2020 18:48 UTC)
|
Re: Maybe macros
Marc Nieper-Wißkirchen
(26 Jun 2020 18:57 UTC)
|
Re: Maybe macros
John Cowan
(27 Jun 2020 04:29 UTC)
|
Re: Maybe macros
Arthur A. Gleckler
(26 Jun 2020 19:50 UTC)
|
Re: Maybe macros
John Cowan
(26 Jun 2020 19:52 UTC)
|
Re: Maybe macros
Wolfgang Corcoran-Mathe
(27 Jun 2020 03:44 UTC)
|
Re: Maybe macros
Arthur A. Gleckler
(27 Jun 2020 03:59 UTC)
|
Re: Maybe macros
Wolfgang Corcoran-Mathe
(27 Jun 2020 04:15 UTC)
|
Re: Maybe macros
Arthur A. Gleckler
(27 Jun 2020 04:29 UTC)
|
Re: Maybe macros
Wolfgang Corcoran-Mathe
(27 Jun 2020 14:09 UTC)
|
Re: Maybe macros
John Cowan
(27 Jun 2020 18:55 UTC)
|
Re: Maybe macros
Marc Nieper-Wißkirchen
(27 Jun 2020 20:46 UTC)
|
Re: Maybe macros
John Cowan
(27 Jun 2020 21:34 UTC)
|
Re: Maybe macros
Wolfgang Corcoran-Mathe
(28 Jun 2020 17:26 UTC)
|
Re: Maybe macros Marc Nieper-Wißkirchen (28 Jun 2020 17:43 UTC)
|
Re: Maybe macros
Wolfgang Corcoran-Mathe
(28 Jun 2020 18:52 UTC)
|
Re: Maybe macros
Marc Nieper-Wißkirchen
(28 Jun 2020 20:24 UTC)
|
Re: Maybe macros
John Cowan
(28 Jun 2020 18:54 UTC)
|
Re: Maybe macros
Marc Nieper-Wißkirchen
(28 Jun 2020 20:21 UTC)
|
Re: Maybe macros
Alex Shinn
(29 Jun 2020 00:02 UTC)
|
Re: Maybe macros
Marc Nieper-Wißkirchen
(29 Jun 2020 06:23 UTC)
|
Re: Maybe macros
Wolfgang Corcoran-Mathe
(28 Jun 2020 16:54 UTC)
|
Am So., 28. Juni 2020 um 19:26 Uhr schrieb Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>: > 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). If the values of the Maybe/Either returned by the empty `...-and' or `...-or' forms are accessed to be processed further, the code is most likely doing something very wrong. Zero values actually help here to catch such logical errors because they will more likely raise an error. > The unit of the operations are, > respectively, any Just/Left/Right, so it makes sense to me that we > leave the payload unspecified. Note that there is not *the* unit, but there are *"des"* units. (Unfortunately, English as German is lacking the plural indefinite article so I had resort to French.) If you want to leave the payload unspecified, you should also leave the number of unspecified values unspecified. That certainly makes sense. The best unit would be a Just/Left/Right for which it would be an error to unwrap it. This could be some singleton value.