<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 3, 2017 at 10:48 AM, Richard Eisenberg <span dir="ltr"><<a href="mailto:rae@cs.brynmawr.edu" target="_blank">rae@cs.brynmawr.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Mar 3, 2017, at 12:45 PM, Kris Nuttycombe <<a href="mailto:kris.nuttycombe@gmail.com" target="_blank">kris.nuttycombe@gmail.com</a>> wrote:</div><br class="m_-7292570397675902807Apple-interchange-newline"><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">This is an interesting assertion; I don't believe that these goals work against one another at all. In fact, I find that (b) leads to "if it compiles, it works" much more often than not. John De Goes goes into depth on this principle here:<span class="m_-7292570397675902807Apple-converted-space"> </span></span><a href="http://degoes.net/articles/insufficiently-polymorphic" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://degoes.net/<wbr>articles/insufficiently-<wbr>polymorphic</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span class="m_-7292570397675902807Apple-converted-space"> </span>where he points out "Monomorphic code is much more likely to be incorrect than polymorphic code, because for every type signature, there are many more possible implementations.".</span></div></blockquote></div><br></span><div>Ah -- very good point. This is true for the *implementation* of a polymorphic function, where a polymorphic type signature beautifully restricts what the function can do. But it is not true for monomorphic *uses* of a polymorphic function, where the generality can lead to an unexpected instance selection and thus runtime behavior.</div></div></blockquote><div><br></div><div>I guess that, in the limit, this is why my code has been progressively mutating to a style in which I only define data structures for the purpose of being able to easily generate classy lenses/prisms into their components/inhabitants. I now generally find concrete types more restrictive and error-prone than I care for.</div></div></div></div>