
29 Apr
2008
29 Apr
'08
6:01 a.m.
Whenever I try to inline a lot of nested function calls, GHC decides to specialise one of the functions and the specialised function is no longer inlined. I hoped to get the function inlined anyway by specialising it manually. Say, I want to inline genericFunc {-# INLINE genericFunc #-} genericFunc :: RealFrac a => a -> Int but GHC inserts a call to genericFunc1 specialised to a=Double where I apply genericFunc to a Double argument. Now I define {-# INLINE doubleFunc #-} doubleFunc :: Double -> Int doubleFunc = genericFunc However, in the Core output 'doubleFunc' does not get the __inline_me tag and thus will not be inlined, too. :-(