<div dir="ltr">This is confusing me, and I'm wondering if it's a compiler bug. I have this:<br><div><br></div><div style> foo = (++) `on` show</div><div style><br></div><div style>I'm expecting the type to be:</div>
<div style><br></div><div style> foo :: Show a => a -> a -> String</div><div style><br></div><div style>But GHCI is inferring:</div><div style><br></div><div style> foo :: () -> () -> 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'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>