[Haskell-cafe] Strange type behavior in GHCi 6.4.2

Kirsten Chevalier catamorphism at gmail.com
Fri Dec 29 10:30:22 EST 2006


On 12/29/06, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
> i propose you to use INLINE pragma:
>
> {-# INLINE foo #-}
>
> unless your function is recursive. in this case, you should use SPECIALIZE
> pragma:
>
> {-# SPECIALIZE foo :: Double -> Double -> Double #-}
>

I suggest *not* using these pragmas unless a combination of profiling
and reading intermediate code dumps suggests that foo -- and its
un-specialized nature -- is truly a bottleneck. Excessive amounts of
SPECIALIZE pragmas can make your code ugly without actually improving
performance if you optimize prematurely (and I speak from experience).
Think *first*, add pragmas later; again, people on the mailing lists
and IRC channel are usually happy to provide guidance with this.

Cheers,
Kirsten

-- 
Kirsten Chevalier* chevalier at alum.wellesley.edu *Often in error, never in doubt
"To be free is not to have the power to do anything you like; it is to be able
to surpass the given towards an open future..."--Simone de Beauvoir


More information about the Haskell-Cafe mailing list