seq as type class method

Henning Thielemann lemming at henning-thielemann.de
Mon Nov 9 07:19:39 EST 2009


On Mon, 9 Nov 2009, Neil Mitchell wrote:

>> |    -- | 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.

I assume the case in stream-fusion:Data.Stream was vice versa: A one 
member class seemed to make performance worse .Thus they added a dummy 
method.


More information about the Libraries mailing list