specialization using RULES
simonpj at microsoft.com
Tue Jun 5 03:49:39 EDT 2007
| The rules do not fire. They only seem to fire if the specialized
| function is called directly, such as
| > doSomethingWith ( zipWith (-) (u :: Vec Three Double) v )
That's probably because to fire
distance must be inlined
but sumV and mapV must not
which is obviously a bit delicate.
To do that you need fairly fine grain control over exactly when inlining takes place. That's what the [n] part of an INLINE pragma is for. Look in GHC.Base for examples. Don and Duncan are experts.
I wish there was a more robust way to do this.
More information about the Glasgow-haskell-users