optional definition

Li-yao Xia lysxia at gmail.com
Sun Sep 1 13:42:18 UTC 2019

Link to the definition being discussed: 

On 9/1/19 5:27 AM, Dannyu NDos wrote:
> The current 'one or none' definition breaks the order of elements.

But `optional` does try, in order, to produce one element before falling 
back to `Nothing`.

optional v = (Just <$> v) <|> pure Nothing
--           one          or       none

> It is more Ord-friendly to define it as 'none or one'.

Why is it a good thing for "Alternative" to be "Ord-friendly"? 
"Alternative" has little to do with "Ord" in the first place.


More information about the Libraries mailing list