[Haskell-cafe] ANN: HLint 1.2
Bas van Dijk
v.dijk.bas at gmail.com
Mon Jan 12 13:43:00 EST 2009
On Mon, Jan 12, 2009 at 6:47 PM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> GHC should indeed be doing so. I'm working (on and off) to work out
> some suitable heuristics and put the transformation into ghc -O2.
> There are a few wrinkles that still need sorting out, but preliminary
> indications are that it decreases the runtime of our standard
> benchmark suite, nofib, by 12% or so.
In the Stream library I'm developing at http://code.haskell.org/Stream
I 'closurize' (for lack of a better name) all my functions. Here are a
few random examples:
repeat :: a -> Stream a
repeat x = repeat_x
repeat_x = x ::: repeat_x
cycle :: [a] -> Stream a
cycle xs = cycle_xs
cycle_xs = foldr (:::) cycle_xs xs
deleteBy :: (a -> a -> Bool) -> a -> Stream a -> Stream a
deleteBy eq x = deleteBy_eq_x
deleteBy_eq_x (y ::: ys)
| eq x y = ys
| otherwise = y ::: deleteBy_eq_x ys
Closurizing the functions in Data.Stream lead to 10% to 250% speedups!
Note that I follow a particular naming convention for the inner worker
functions. I use the top level function name and append the
'closurized' arguments to it interspersed with underscores.
More information about the Haskell-Cafe