On 10/05/2017 02:32 AM, Bill Page wrote:
>> I think current situation is a good compromise. We can
>> say in documentation that all instances of Maybe share
>> a common value of failed(), and nested usage of Maybe
>> is not recommended, Maybe should not be used as Rep
>> itself but can be part of Rep. Do you agree?
> I value correctness much more than performance except in the most
> extreme and special cases.
There is no general "correctness". Code only behaves correctly
with respect to a certain specification.
As Qian said, the specification would claim Maybe to a very special
case. There is a fixed value "failed()" and that is global over all
domains and not element of any other domain than Maybe(X). Then Maybe(X)
represensts
X \cup \{failed()\}
With that, of course, Maybe(Maybe(X)) must behave like Maybe(X). I don't
see any (big) problem with that, just that Maybe(X) is not the same as
extending the domain by some new element, but it stands for "adding
failed() to the domain". I don't see any problem with "correctness".
However, then I would really opt for another name. Otherwise one might
think that Maybe behaves according to the type equation
FX = 1 + X
(see https://wiki.haskell.org/Maybe). Actually, I don't know whether
"Nothing" in Haskell is a global value, but I guess, it it not.
Ralf
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.