<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Tony: I'll take you at your word that you really would like an example of why we have a bee in our bonnet, in order to understand better. Here's an example of a program that can cause pain:</div><div><br></div><div>avg l = sum l / fromIntegral (length l)</div><div><br></div><div>... elsewhere ...</div><div><br></div><div>f x = map (+1) x</div><div><br></div><div>...elsewhere...</div><div><br></div><div>y = avg $ f foo</div><div><br></div><div><br></div><div>Then we change the definition of f to contain some extra data:</div><div><br></div><div>f x = (map (+1) x, bar)</div><div><br></div><div>Without warning, we suddenly get "bar" instead of the average we expected, and it all typechecks. Just, the data we get is wrong. We may not even notice the data is wrong at first. This isn't hypothetical: I've been bitten by this more than once. Now I've started writing "(length::[a]->Int)", "(maximum::Ord a=>[a]->a)" etc so I don't shoot myself in the foot.</div><div><br></div><div>Hope this is helpful.</div><div>Tom</div><div><br></div><div><br>El 19 mar 2017, a las 21:30, Tony Morris <<a href="mailto:tonymorris@gmail.com">tonymorris@gmail.com</a>> escribió:<br><br></div><blockquote type="cite"><div><div dir="ltr">What intuition exactly? Demonstrate it to me so that I may empathise with it. What pain? Show it to me. Are you sure it's intuition and not something else? How are you so sure?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 20, 2017 at 12:28 PM, Artyom Kazak <span dir="ltr"><<a href="mailto:yom@artyom.me" target="_blank">yom@artyom.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div class="gmail_extra" dir="auto"><div class="gmail_quote">On 20 Mar 2017 1:31 a.m., "Tony Morris" <<a href="mailto:tonymorris@gmail.com" target="_blank">tonymorris@gmail.com</a>> wrote:<blockquote class="m_-1042257989186229919quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    <p>"But the inconsistency with my intuition for the function named
      l-e-n-g-t-h that I learned in C programming school in the 1980s"
      is the best criteria that I have seen, and which commands outright
      dismissal.</p></div></blockquote></div></div></span><div dir="auto">This is exactly my criterion (except that I learned English, not C), and I do not agree with you that it "commands outright dismissal". There is value in functions being as general as possible, etc, but there is also value in conforming to human intuitions â€“ because it prevents people from shooting themselves in their feet. Whether those intuitions come from math, or from C, or from English, or elsewhere, is entirely irrelevant. If behavior of `length` fully conforms to your intuitions, that's splendid and you're lucky; however, for me and my usecases it's *only* a source of pain, and I want a way to free myself of that pain (without having to learn another language or spend time trying to change my intuitions).</div><div dir="auto"><br></div><div dir="auto">Wanting to make one's life easier is not an unreasonable desire.</div><div class="gmail_extra" dir="auto"></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Tony Morris<br><a href="http://tmorris.net/" target="_blank">http://tmorris.net/</a></div>
</div>
</div></blockquote></body></html>