> I hope that compilers will be able to reasonably inline it, 
> eliminating
> the overhead. At least theorethically is should be possible.
> 
> Unfortunately I guess that GHC does not unfold any recursion.
> Maybe it won't be hard to make it possible to add a hint:
>    {-# UNFOLD 6 callIO #-}
> that the programmer politely asks to try to inline and unfold the
> recursion up to 6 times at call sites to see if it finishes?

Since the type is explicit, GHC should be able to inline away all the
overloading.  In fact there's no recursion here: the recursive call to
callIO is to a method pulled out of the dictionary passed in as an argument,
and the values of the dictionaries will all be available at compile time.

This is way cool, BTW :)

Cheers,
        Simon

Reply via email to