[project @ 2001-03-05 15:37:25 by simonpj]
Exploit the 1-shot lambda HACK in etaExpandArity We often find code like f :: Int -> IO () f = \ x -> case ... of p1 -> \s -> ...rhs1... p2 -> \s -> ...rhs2... where the \s is a state transformer lambda. Almost invariably these \s things are one-shot; that is, we virtually never say let h = f 3 in h >> h >> h In this case we'd be much better off eta-expanding f, to f :: Int -> IO () f = \ x \ s -> case ... of p1 -> ...rhs1... p2 -> ...rhs2... GHC already has a MAJOR HACK in Id.isOneShotLambda which declares that any \s::State# T is a one-shot lambda. It's almost always true, and it makes a big difference. This commit simply makes use of isOneShotLambda to improve the results of CoreUtils.etaExpandArity. Which has the desired effect. There isn't a flag to control the MAJOR HACK yet. Maybe there should be. Anyway, some of Manuel's array code should improve a lot.
Showing with 45 additions and 16 deletions