Dan Rosen asks whether GHC has a lambda lifter. Yes, it does: GHC's full-laziness pass also doubles as a lambda lifter
- It's controlled by the
- This in turn is set from the
DynFlagsare set in module
However on trying a small experiment on
f x = map (\y -> (x,y))
I see a bug and an infelicity.
- Bug: the comment with the
floatOutLambdasfield definition claims that
Nothingmeans float all lambdas to the top. But the code in
Nothingidentically, which contradicts the comment. Workaround: use
- Infelicity: with
lvl_sdQ = \ (@ t_acm) (@ t_acn) (x_a9H :: t_acm) (y_a9I :: t_acn) -> (x_a9H, y_a9I) Foo.f = \ (@ t_acm) (@ t_acn) (x_a9H [Dmd=Just L] :: t_acm) (eta_B1 :: [t_acn]) -> GHC.Base.map @ t_acn @ (t_acm, t_acn) (lvl_sdQ @ t_acm @ t_acn x_a9H) eta_B1
which is good, but then the next simplifier run inlines it straight back in again, via
preInlineUnconditionally should be a bit less gung-ho, perhaps, but I don't want to change it until I've see if there are any performance regressions.