@@ -312,7 +312,7 @@ magicDo' = everywhere (mkT undo) . everywhere' (mkT convert)
312312 isRetPoly (JSIndexer (JSStringLiteral "return") (JSAccessor "Prelude" (JSVar "_ps"))) = True
313313 isRetPoly _ = False
314314 -- Check if an expression represents a function in the Ef module
315− isEffFunc name (JSAccessor name' (JSAccessor "Eff" (JSVar "_ps"))) | name == name' = True
315+ isEffFunc name (JSAccessor name' (JSAccessor "Control_Monad_Eff" (JSVar "_ps"))) | name == name' = True
316316 isEffFunc _ _ = False
317317 -- Module names
318318 prelude = ModuleName [ProperName "Prelude"]
@@ -324,7 +324,7 @@ magicDo' = everywhere (mkT undo) . everywhere' (mkT convert)
324324 (TypeConstructor (Qualified (Just effModule) (ProperName "Eff")))
325325 -- Check if an expression represents the Monad Eff dictionary
326326 isEffDict (JSApp (JSVar ident) [JSObjectLiteral []]) | ident == effDictName = True
327− isEffDict (JSApp (JSAccessor prop (JSAccessor "Eff" (JSVar "_ps"))) [JSObjectLiteral []]) | prop == effDictName = True
327+ isEffDict (JSApp (JSAccessor prop (JSAccessor "Control_Monad_Eff" (JSVar "_ps"))) [JSObjectLiteral []]) | prop == effDictName = True
328328 isEffDict _ = False
329329 -- Remove __do function applications which remain after desugaring
330330 undo :: JS -> JS
@@ -345,7 +345,7 @@ inlineST = everywhere (mkT convertBlock)
345345 usages = findAllSTUsagesIn arg
346346 allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages
347347 localVarsDoNotEscape = all (\r -> length (r `appearingIn` arg) == length (filter (\u -> let v = toVar u in v == Just r) usages)) refs
348− in everywhere (mkT $ convert allUsagesAreLocalVars) arg
348+ in everywhere (mkT $ convert (allUsagesAreLocalVars && localVarsDoNotEscape)) arg
349349 convertBlock other = other
350350 -- Convert a block in a safe way, preserving object wrappers of references,
351351 -- or in a more aggressive way, turning wrappers into local variables depending on the
@@ -364,7 +364,7 @@ inlineST = everywhere (mkT convertBlock)
364364 JSAssignment (JSIndexer i arr) val
365365 convert _ other = other
366366 -- Check if an expression represents a function in the ST module
367− isSTFunc name (JSAccessor name' (JSAccessor "ST" (JSVar "_ps"))) | name == name' = True
367+ isSTFunc name (JSAccessor name' (JSAccessor "Control_Monad_ST" (JSVar "_ps"))) | name == name' = True
368368 isSTFunc _ _ = False
369369 -- Find all ST Refs initialized in this block
370370 findSTRefsIn = everything (++) (mkQ [] isSTRef)