<div dir="ltr"><div><br></div><div><br></div>hey sandy!<div>i absolutely support this, </div><div><br></div><div>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 optimizes</div><div><br></div><div>theres 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 :)</div><div><br></div><div>either way, please throw a PR onto gitlab and @ myself and other folks for review <br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 14, 2020 at 5:38 PM Sandy Maguire <<a href="mailto:sandy@sandymaguire.me">sandy@sandymaguire.me</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hi all,<br><br></div>It seems to me that base is missing the very standard function `clamp :: Ord a => a -> a -> a -> a`:<br><br></div><div>```haskell</div><div>clamp :: Ord a => a -> a -> a -> a</div><div>clamp low high = min high .max low<br></div><div>```<br><br></div><div>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.)</div><div><br></div><div>Thanks,<br></div><div>Sandy</div></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>