@@ -19,6 +19,7 @@ module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
1919 inlineOperator,
2020 inlineCommonOperators,
2121 inlineAppliedArrComposition,
22+ inlineAppliedVars,
2223 etaConvert,
2324 unThunk,
2425 evaluateIifes
@@ -246,6 +247,13 @@ inlineAppliedArrComposition = everywhereOnJS convert
246247 convert (JSApp (JSApp (JSApp (JSApp fn [dict']) [x]) [y]) [z]) | isDict semigroupoidArr dict' && isPreludeFn (C.<<<) fn = JSApp x [JSApp y [z]]
247248 convert other = other
248249
250+inlineAppliedVars :: JS -> JS
251+inlineAppliedVars = everywhereOnJS convert
252+ where
253+ convert :: JS -> JS
254+ convert (JSApp (JSFunction Nothing [a] (JSBlock [JSReturn b])) [JSVar x]) = replaceIdent a (JSVar x) b
255+ convert other = other
256+
249257isDict :: (String, String) -> JS -> Bool
250258isDict (moduleName, dictName) (JSAccessor x (JSVar y)) = x == dictName && y == moduleName
251259isDict _ _ = False