git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Remove inlineAppliedVars

It seemed like this was necessary because I didn't fully understand all that etaConvert was doing. It also looked like it was doing something useful with the (<<<) optimisation but now removing it doesn't change the behaviour.

commite9293278ad20f959c646d62201c9613610329cf7 authorBrian McKenna <brian@brianmckenna.org> dateTue 21 Apr 2015, 11:03 (12 years ago) parenta411755
2 files changed+1−10
src/Language/PureScript/CodeGen/JS/Optimizer.hs+1−2 src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs−8
src/Language/PureScript/CodeGen/JS/Optimizer.hs+1−2
@@ -79,8 +79,7 @@ optimize' js = do
7979 , inlineOperator (C.prelude, (C.$)) $ \f x -> JSApp f [x]
8080 , inlineOperator (C.prelude, (C.#)) $ \x f -> JSApp f [x]
8181 , inlineOperator (C.preludeUnsafe, C.unsafeIndex) $ flip JSIndexer
82− , inlineCommonOperators
83− , inlineAppliedVars ]) js
82+ , inlineCommonOperators ]) js
8483
8584untilFixedPoint :: (Monad m, Eq a) => (a -> m a) -> a -> m a
8685untilFixedPoint f = go
src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs−8
@@ -18,7 +18,6 @@ module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
1818 inlineValues,
1919 inlineOperator,
2020 inlineCommonOperators,
21− inlineAppliedVars,
2221 inlineArrComposition,
2322 etaConvert,
2423 unThunk,
@@ -241,13 +240,6 @@ inlineCommonOperators = applyAll $
241240 go m acc (JSApp lhs [arg]) = go (m - 1) (arg : acc) lhs
242241 go _ _ _ = Nothing
243242
244−inlineAppliedVars :: JS -> JS
245−inlineAppliedVars = everywhereOnJS convert
246− where
247− convert :: JS -> JS
248− convert (JSApp (JSFunction Nothing [a] (JSBlock [JSReturn b])) [JSVar x]) = replaceIdent a (JSVar x) b
249− convert other = other
250−
251243-- (f <<< g $ x) = f (g x)
252244-- (f <<< g) = \x -> f (g x)
253245inlineArrComposition :: (Applicative m, MonadSupply m) => JS -> m JS