RE: inlining higher-order-functions?

2006-12-22 Thread Simon Peyton-Jones
| My example is complicated, so let me present a simpler analogy. | Suppose I defined | | compose :: (b - c) - (a - b) - (a - c) | compose f g = \x - f (g x) | | I can easily persuade GHC to inline 'compose'. | But when 'compose' is applied to known arguments, I wish | f and g to be inlined in the

Re: inlining higher-order-functions?

2006-12-22 Thread Bulat Ziganshin
Hello Norman, Friday, December 22, 2006, 8:23:57 AM, you wrote: compose :: (b - c) - (a - b) - (a - c) compose f g = \x - f (g x) ghc 6.6 added 'inline' function, see user docs. although only SPJ knows whether it can be used here: compose f g = inline (\x - f (g x)) -- Best regards, Bulat

inlining higher-order-functions?

2006-12-21 Thread Norman Ramsey
I've just discovered the {-# INLINE #-} pragma, but it's not doing as much for me as I had hoped. My example is complicated, so let me present a simpler analogy. Suppose I defined compose :: (b - c) - (a - b) - (a - c) compose f g = \x - f (g x) I can easily persuade GHC to inline 'compose'.