> > Solution: add an INLINE pragma to 'arr'. This has the
> > effect of *preventing* inlining in arr's RHS, and causing
> > 'arr' to be inlined at every call site.
> >
> > This is an annoying gotcha when using RULES, but I don't see an
> > easy fix.
>
> Whats wrong with simply keeping track of all the functions used in the
> LHS of a rule and if one of these functions appears in the RHS of a
> definition add an implicate INLINE pragma.
Trouble is, that means you never do any inlining in the body
of a function that has mentions any function on the LHS of any rule.
So any function that mentions map, fold, zip, etc will have no inlining
done on its RHS. No thanks!
A milder alternative would be never to inline any function
that appears on the LHS of a rule. But that's too drastic too.
Sometimes it's not until you inline one function that you expose
opportunities for new rules, and more mundane optimisations too.
e.g. not until we inline build do we see
foldr (:) ys xs = append xs ys
Simon