Hi Oleg,
I'm quite puzzled at the statement. Is there really significant
> the need to define a duplicate of the class (MonadState' in your
> example) bloats the code significantly.
bloat? Let us count.
As the first example, let's take
class C a
with N special instances, mutually non-overlapping instances, and one
catch-all instance "instance C a". We have N+1 instances total.
With the technique in the earlier message, we define an auxiliary
class C' a flag
with N special and one catch-all instance, all non-overlapping. We
then define one instance of the original class C, performing the
dispatch. The additional cost: one class declaration and one
instance. Is one extra class and one instance considered a bloat?
The extra class is systematically derived from the original one
(so, one could get TH to do the deriving).
> But I am still doubtful of the runtime performance of your codeI believe discussing performance may be a bit premature;