<div dir="ltr">This is confusing me, and I&#39;m wondering if it&#39;s a compiler bug. I have this:<br><div><br></div><div style>   foo = (++) `on` show</div><div style><br></div><div style>I&#39;m expecting the type to be:</div>

<div style><br></div><div style>    foo :: Show a =&gt; a -&gt; a -&gt; String</div><div style><br></div><div style>But GHCI is inferring:</div><div style><br></div><div style>    foo :: () -&gt; () -&gt; String</div><div style>

<br></div><div style><br></div><div style>If I explicitly provide a type annotation, or if I use -XNoMonormorphismRestriction, then it all works fine. I would expect a compile error if the type couldn&#39;t be inferred due to the Monomorphism Restriction, but instead it has silently chosen the least useful type.</div>

<div style><br></div><div style>Peter</div></div>