seq as type class method

Neil Mitchell ndmitchell at
Mon Nov 9 06:32:01 EST 2009

> |    -- | This makes GHC's optimiser happier; it sometimes produces really bad
> |    -- code for single-method dictionaries
> |    --
> |    unlifted_dummy :: a
> |    unlifted_dummy = error "unlifted_dummy"
> If you have such cases, please please boil it down and file it as a bug.  We should get *better* code not worse for
> single-method dictionaries.

I benchmarked this when doing the Uniplate work - 1-member classes
gave a noticeable performance benefit over 2 or more members. I think
it was 6% or so in my setup, and as a result Uniplate has a single
member type class.

Thanks, Neil

More information about the Libraries mailing list