[Haskell-cafe] Strange type behavior in GHCi 6.4.2

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Dec 29 06:29:10 EST 2006

Hello Grady,

Friday, December 29, 2006, 10:12:12 AM, you wrote:

> not get that in the way I want.  I suppose there may have to be some
> slowdown -- if the compiler specializes every piece of code for every
> instance of a typeclass it might encounter, it could bloat the
> executable beyond all reason.  I'll have to do some tests to see if I
> notice an effect in practice.

yes. ghc makes specialization only in cases when you used SPECIALIZE/INLINE
pragma and when function is small enough to be inlined. otherwise, each (+)
operation will make a function call which is very slow thing in Haskell

i propose you to use INLINE pragma:

{-# INLINE foo #-}

unless your function is recursive. in this case, you should use SPECIALIZE

{-# SPECIALIZE foo :: Double -> Double -> Double #-}

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list