@@ -20,7 +20,7 @@ module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
2020 inlineValues,
2121 inlineOperator,
2222 inlineCommonOperators,
23− inlineArrComposition,
23+ inlineFnComposition,
2424 etaConvert,
2525 unThunk,
2626 evaluateIifes
@@ -244,18 +244,18 @@ inlineCommonOperators = applyAll $
244244
245245-- (f <<< g $ x) = f (g x)
246246-- (f <<< g) = \x -> f (g x)
247−inlineArrComposition :: (Applicative m, MonadSupply m) => JS -> m JS
248−inlineArrComposition = everywhereOnJSTopDownM convert
247+inlineFnComposition :: (Applicative m, MonadSupply m) => JS -> m JS
248+inlineFnComposition = everywhereOnJSTopDownM convert
249249 where
250250 convert :: (MonadSupply m) => JS -> m JS
251− convert (JSApp (JSApp (JSApp (JSApp fn [dict']) [x]) [y]) [z]) | isArrCompose dict' fn =
251+ convert (JSApp (JSApp (JSApp (JSApp fn [dict']) [x]) [y]) [z]) | isFnCompose dict' fn =
252252 return $ JSApp x [JSApp y [z]]
253− convert (JSApp (JSApp (JSApp fn [dict']) [x]) [y]) | isArrCompose dict' fn = do
253+ convert (JSApp (JSApp (JSApp fn [dict']) [x]) [y]) | isFnCompose dict' fn = do
254254 arg <- freshName
255255 return $ JSFunction Nothing [arg] (JSBlock [JSReturn $ JSApp x [JSApp y [JSVar arg]]])
256256 convert other = return other
257− isArrCompose :: JS -> JS -> Bool
258− isArrCompose dict' fn = isDict semigroupoidArr dict' && isPreludeFn (C.<<<) fn
257+ isFnCompose :: JS -> JS -> Bool
258+ isFnCompose dict' fn = isDict semigroupoidFn dict' && (isPreludeFn (C.<<<) fn || isPreludeFn (C.compose) fn)
259259
260260isDict :: (String, String) -> JS -> Bool
261261isDict (moduleName, dictName) (JSAccessor x (JSVar y)) = x == dictName && y == moduleName
@@ -314,5 +314,5 @@ boundedBoolean = (C.prelude, C.boundedBoolean)
314314booleanAlgebraBoolean :: (String, String)
315315booleanAlgebraBoolean = (C.prelude, C.booleanAlgebraBoolean)
316316
317−semigroupoidArr :: (String, String)
318−semigroupoidArr = (C.prelude, C.semigroupoidArr)
317+semigroupoidFn :: (String, String)
318+semigroupoidFn = (C.prelude, C.semigroupoidFn)