<html><head></head><body><div><div><div style="display: none; border: 0px; width: 0px; height: 0px; overflow: hidden; visibility: hidden;"><img src="https://r.superhuman.com/hnhLbOEX6rIyjxROApANecoT16faaF7YR94v0BHjXreH_-joiSe5htt_MxZikayIeqX7KNXtkbrEgUBTJDFT6GiRH6eU0dcCFdj5uwqcOnaeEZzQjrxKqkc6RZTk65XGofDfUxt69LVMkJKxZK1qPzIhmm3d_Li_YNXqx6R1Tj9kXYiIv3mudCs.gif" alt=" " width="1" height="0" style="display: none; border: 0px; width: 0px; height: 0px; overflow: hidden; visibility: hidden;"/><!--                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                --></div><div><div><div>+1, though, David has good points about unnecessary laziness. I'm fine with the name and the signature <br/><br/>```<br/>clamp :: Ord a ⇒ (a,a) → a → a<br/>```<br/></div><div><br/>(or some variation on the theme). </div></div><br/><div class="gmail_signature"></div></div><br/><div><div class="gmail_quote">On Fri, Aug 14, 2020 at 5:38 PM, Sandy Maguire <span dir="ltr"><<a href="mailto:sandy@sandymaguire.me" target="_blank">sandy@sandymaguire.me</a>></span> wrote:<br/><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote sh-color-black sh-color" style="null" id="null"><div dir="ltr" class="sh-color-black sh-color"><div class="sh-color-black sh-color"><div class="sh-color-black sh-color">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 class="sh-color-black sh-color">```haskell</div><div class="sh-color-black sh-color">clamp :: Ord a => a -> a -> a -> a</div><div class="sh-color-black sh-color">clamp low high = min high .max low<br/></div><div class="sh-color-black sh-color">```<br/><br/></div><div class="sh-color-black sh-color">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 class="sh-color-black sh-color"><br/></div><div class="sh-color-black sh-color">Thanks,<br/></div><div class="sh-color-black sh-color">Sandy</div></div>

<p class="sh-color-black sh-color">_______________________________________________
<br/>
Libraries mailing list
<br/>
<a target="_blank" rel="noopener noreferrer" href="mailto:Libraries@haskell.org">Libraries@<wbr/>haskell.<wbr/>org</a>
<br/>
<a target="_blank" rel="noopener noreferrer" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http:/<wbr/>/<wbr/>mail.<wbr/>haskell.<wbr/>org/<wbr/>cgi-bin/<wbr/>mailman/<wbr/>listinfo/<wbr/>libraries</a></p></div></div></blockquote></div></div><br/></div></div></body></html>