
2011/2/15 Simon Peyton-Jones
but currently any pragmas in a class decl are treated as attaching to the *default method*, not to the method selector:
I see. I didn't realise that that was what was happening. Personally I find this a bit surprising, but I can see the motivation. Of course, a sensible alternative design would be to have them control the selectors, and then you could declare that you want your default methods to be inlined like this: {{{ class MyClass a where foo :: a -> a foo = default_foo {-# INLINE default_foo #-} default_foo = ... big expression ... }}} I think this design+workaround is slightly preferable to your proposal because it avoids clients of a library defining a class from having to write instances with decorated names. But maybe it's not such a big win as to be worth making the change. In any event, perhaps it would be worth warning if you write an INLINE pragma for some identifier in a class declaration where no corresponding default method has been declared, in just the same way you would if you wrote an INLINE pragma for a non-existant binding? Cheers, Max