
1 Sep
2019
1 Sep
'19
1:42 p.m.
Link to the definition being discussed: https://hackage.haskell.org/package/base-4.12.0.0/docs/Control-Applicative.h... 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. Cheers, Li-yao