26 Mar
2026
26 Mar
'26
2:16 p.m.
On Thu, Mar 26, 2026 at 05:10:59PM +1100, Viktor Dukhovni wrote:
So in practice, in code that is polymorphic in the container type, it is better to define:
minimumMaybe :: (Ord a, Foldable t) => t a -> Maybe a minimumMaybe (null -> True) = Nothing minimumMaybe xs = Just $! minimum xs
maximumMaybe :: (Bounded a, Ord a, Foldable t) => t a -> a maximumMaybe (null -> True) = Nothing maximumMaybe xs = Just $! maximum xs
Sorry about the cut/paste error, that should have been: maximumMaybe :: (Ord a, Foldable t) => t a -> Maybe a -- Viktor. 🇺🇦 Слава Україні!