Open felixSchl opened 6 years ago
Do you think it makes sense to push these optimization issues further upstream? Maybe into purescript-corefn
if not all the way back up to purescript
?
The optimizations in the PureScript codebase are performed on the JS AST, not on CoreFn, so I am not quite sure what you mean - would you mind elaborating?
Some of these transformations could be performed on the CoreFn AST. Like, isn't the majority (if not all) of MagicDo
converting calls to bind
to let-bindings? Similarly, for things like function composition inlining, that could be done on the CoreFn AST.
There's some that won't work, like inlining (+)
or whatever, but some of these could be pushed up to be done once and for all.
https://github.com/purescript/purescript/blob/b07042fb7b4f6a68c0fdc68b7e51076b7106cfba/src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs