cross module optimization issues

John Lato jwlato at gmail.com
Fri Nov 28 10:56:16 EST 2008


Yes, this does help, thank you.  I didn't know you could generate
specialized instances.  In fact, I was so sure that this was some
arcane feature I immediately went to the GHC User Guide because I
didn't believe it was documented.

I immediately stumbled upon Section 8.13.9.

Thanks to everyone who helped me with this.  I think I've achieved a
small bit of enlightenment.

Cheers,
John

On Fri, Nov 28, 2008 at 2:46 PM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> The $f2 comes from the instance Monad (IterateeGM ...).
> print_lines uses a specialised version of that instance, namely
>        Monad (IterateeGM el IO)
> The fact that print_lines uses it makes GHC generate a specialised version of the instance decl.
>
> Even in the absence of print_lines you can generate the specialised instance thus
>
> instance Monad m => Monad (IterateeGM el m) where
>    {-# SPECIALISE instance Monad (IterateeGM el IO) #-}
>        ... methods...
>
> does that help?
>
> Simon
>


More information about the Glasgow-haskell-users mailing list