Really bad code for single method dictionaries?

Max Bolingbroke batterseapower at
Fri Mar 27 04:18:49 EDT 2009

2009/3/26 Jason Dusek <jason.dusek at>:
>  I was reading the stream fusion code today and came across a comment stating
>  that single element dictionaries interacted poorly with GHC's optimizer:
>    class Unlifted a where
>      [...]
>      expose [...]
>      -- | This makes GHC's optimiser happier; it sometimes produces really bad
>      -- code for single-method dictionaries
>      --
>      unlifted_dummy [...]
>  A cursory search on GHC's Trac shows no corresponding bug; is this no longer
>  a problem? A small problem? I would like to know more about it.

I'm not sure if there is a bad interaction with rewrite rules (which I
assume was the complaint) but single method dictionaries tend to be
faster because they are represented by a coercion in the Core
language, which means that packing and unpacking the dictionary is
free at runtime.


More information about the Glasgow-haskell-users mailing list