optional definition

Edward Kmett ekmett at gmail.com
Sun Sep 1 14:22:52 UTC 2019


It would also render the combinator useless for its normal purpose.

optional is used mostly to try to run a parser and to either succeed with
its  result (wrapped in a Just) or _failing that_ to just  return Nothing
and carry on.

For monads like parsec, the first parse is the one that gets returned, so
the definition isn't symmetric in behavior.

-Edward

On Sun, Sep 1, 2019 at 2:28 AM Dannyu NDos <ndospark320 at gmail.com> wrote:

> The current 'one or none' definition breaks the order of elements.
>
> It is more Ord-friendly to define it as 'none or one'.
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190901/416b5ad8/attachment.html>


More information about the Libraries mailing list