clamp function in base
Sandy Maguire
sandy at sandymaguire.me
Fri Aug 14 21:38:27 UTC 2020
Hi all,
It seems to me that base is missing the very standard function `clamp ::
Ord a => a -> a -> a -> a`:
```haskell
clamp :: Ord a => a -> a -> a -> a
clamp low high = min high .max low
```
I propose it be added to Data.Ord. It's useful, generic, and non-trivial to
get right (the "big" number goes with "min" -- causes me cognitive
dissonance every time.)
Thanks,
Sandy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200814/aa32d45c/attachment.html>
More information about the Libraries
mailing list