On Mon, Oct 9, 2017 at 4:09 AM, Ralf Hemmecke <[email protected]> wrote:
>>> We can have Maybe with a global failed().
>>
>> But then Maybe would not be a Monad (at least in the since used in Haskell).
>
> Exactly. And that is why for this case I would be rather against the
> name "Maybe". I'd rather opt for "Partial" as in Aldor even though

Let "Partial" stands for the global GENSYM() solution and "Maybe"
stands for the "Rep := List R" solution.
Then we still need to pick a default: what should 'subtractIfCan' return?
We can't have both signatures because that will complicate type inference.
I propose to use "Maybe" as default and to use "Partial" in performance
critical code.

> A more logical representation (which does not rely on the underlying
> Lisp) would be similar to what Partial in Aldor has, see link above.
>
>   Rep == Record(val:T);
>
> It doesn't suggest that there is ever more than one value. Therefore, I

Aldor uses "nil pretend %" for the "failed" value, I guess you don't like
the 'pretend'.

> suggested Rep == Reference(X) in an earlier mail.
>
> Relying on lisp as the target language is not a good idea. I'd rather
> like to be independent of such implementation details.
>
> Ralf

First, "Reference" is not inlined optimized.  Second, Maybe is a low level
Domain, and I need optimization like CONSP$Lisp, QCAR$Lisp.

This thread is pretty long, I'll open a new one with Maybe built on
"Rep := List R".

-- 
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.

Reply via email to