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