25 Mar
2026
25 Mar
'26
10:19 a.m.
Adding that warning won't affect performance, but it would guide people to never use them (Especially Foldable variant; its type is wrong - it would make some sense with Bounded - if Bounded were related to Ord).
For (Bounded a, Ord a) one should replace maximum by an ordinary fold, given a suitable newtype wrapper with a Monoid instance, e.g. (Ord a, Bounded a) => Monoid (Data.Semigroup.Max a) In the past I've also used custom newtypes if e.g. I knew all values were non-negative and the least value I cared about was zero. -- Olaf