This solution, while workable, doesn't seem like the right way to do this. What about improving the inliner to inline function composition/application structures (like this and (fun f g x -> g (f x)), etc) in general?