[Haskell-cafe] rewrite rules to specialize function according to type class?

Max Bolingbroke batterseapower at hotmail.com
Tue Feb 15 17:24:36 CET 2011


On 15 February 2011 15:12, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
> Ah, but you assume that bar won't be inlined into foo first. Consider that
> it is perfectly acceptable for GHC to generate this:
>
> foo = <big>
> {-# INLINE bar #-}
> bar = <big>
>
> We did ask to inline bar, after all.

Well, yes, but when considering the use site for foo don't we now
inline the *original RHS* of foo? This recent change means that it
doesn't matter whether bar gets inlined into foo first - use sites of
foo will only get a chance to inline the "bar" RHS.

Cheers,
Max



More information about the Haskell-Cafe mailing list