[Haskell-cafe] Re: Profiling nested case

Ben Franksen ben.franksen at online.de
Fri Jul 18 19:03:12 EDT 2008


Mitar wrote:
> On Fri, Jul 18, 2008 at 3:54 PM, Chaddaï Fouché
> <chaddai.fouche at gmail.com> wrote:
>>> So that I can easily change the type everywhere. But it would be much
>>> nicer to write:
>>>
>>> data Quaternion a = Q !a !a !a !a deriving (Eq,Show)
>>>
>>> Only the performance of Num instance functions of Quaternion is then
>>> quite worse.
>>
>> You can probably use a specialization pragma to get around that.
> 
> But why is this not automatic? If I use Quaternions of only one type
> in the whole program then why it does not make specialized version for
> it? At least with -O2 switch.

You could try jhc: it does whole program optimization. Ghc compiles each
module separately.

Cheers
Ben



More information about the Haskell-Cafe mailing list