<div dir="ltr">Sounds good. For whatever reason the tupled arguments make me feel better about the `high<low` having undefined behavior. I'll make the change on the MR.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 15, 2020 at 8:22 AM Emily Pillmore <<a href="mailto:emilypi@cohomolo.gy">emilypi@cohomolo.gy</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><div><div><div style="display:none;border:0px none;width:0px;height:0px;overflow:hidden"><img src="https://r.superhuman.com/ICSZK4GwycS-cap7OEd0vU8TJhUOdBWcLN1xUC8eo0wO16GQ-qj8HfPXDc6cyhQgL_CGIfAJG_icT1aWRFjaBj3qOA_jSXwsHhGeGN1d7RJzRZIXs7aDH_VAB1EObpXS7VJE2yYmg86x91XEk6Z_XSv5Fw-khS2C9lbJ-GnK8jOZ_A_eyPQBkhY.gif" alt="" style="display: none; border: 0px none; width: 0px; height: 0px; overflow: hidden;" width="1" height="0"></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></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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote" id="gmail-m_-2328735101368166898null"><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>
<p>_______________________________________________
<br>
Libraries mailing list
<br>
<a rel="noopener noreferrer" href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a>
<br>
<a rel="noopener noreferrer" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a></p></div></div></blockquote></div></div><br></div></div></div></blockquote></div>