Yay! I've opened !3876 at https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3876On Fri, Aug 14, 2020 at 5:45 PM Carter Schonwald <carter.schonwald@gmail.com> wrote:hey sandy!i absolutely support this,theres one gotcha to this definition, handling nans! I also think that this is version of the definition you propose may benefit from being written less point free (eg = \ val -> min high $ max low a) for clarity and for how ghc optimizestheres several ways we could make it play nice with nans, but maybe this should go in as is, to force me to get irate about ord for floats and finish some long overdue patches to Ord on Float and double :)either way, please throw a PR onto gitlab and @ myself and other folks for reviewOn Fri, Aug 14, 2020 at 5:38 PM Sandy Maguire <sandy@sandymaguire.me> wrote:_______________________________________________Hi all,It seems to me that base is missing the very standard function `clamp :: Ord a => a -> a -> a -> a`:```haskellclamp :: Ord a => a -> a -> a -> aclamp 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
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries